[英]Implementing custom atributes for claims based security
I am trying to implement claims based security using System.IdentityModel. 我正在尝试使用System.IdentityModel实现基于声明的安全性。 We are using Windows XP for all development work and therefore cannot use Windows Identity Foundation. 我们将Windows XP用于所有开发工作,因此无法使用Windows Identity Foundation。 What I am trying to do is decorate methods in service contract with permission attributes, I am not sure how to do that 我想做的是用权限属性修饰服务协定中的方法,我不确定该怎么做
For example in my service I want to have method 例如在我的服务中,我想使用方法
void DeleteRecord(int recordId); void DeleteRecord(int recordId);
I want to decorate it with an attribute like this 我想用这样的属性装饰它
[HasDeletePermission] void DeleteRecord(int recordId); [HasDeletePermission] void DeleteRecord(int recordId);
So based on the claimset user has, method will either execute or exception will be thrown. 因此,基于用户拥有的Claimset,方法将执行或抛出异常。 How do I achieve this. 我该如何实现。
您可以使用PostSharp之类的东西将方面嵌入所需的方法中。
Used PostSharp free edition to implement attribute. 使用PostSharp免费版实现属性。 Works well 效果很好
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.