开发者

How to restrict users that consume WCF services

I have a WCF service that must be called by some Active Directory user.

How can I restrict the allowed callers for tha开发者_StackOverflowt WCF service to a specific AD group?


Since you appear to be using Windows authentication, you will be able to use the Active Directory groups and membership of your users inside those groups to restrict the usage of service methods.

With this, you can then use declarative syntax to limit callers to certain groups:

[ServiceContract]
interface IMyService
{
   [OperationContract]
   [PrincipalPermission(SecurityAction.Demand, Role="YourCustomRole")]
   public string MethodLimitedToGroup(string someInput);
}

Anyone who is not member of that group you specified, and tries to call this method, will receive a SecurityException - but nothing else.

Is that what you're looking for?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜