[英]Windows Authentication, Custom permissions, WCF, Active Directory
[英]How to do Role based authentication in WCF using Windows authentication (Active Directory)?
如何使用Windows身份驗證(Active Directory)在WCF中進行基於角色的身份驗證?
我對使用Windows身份驗證(Active Directory)對請求進行身份驗證的要求。 應該定義兩個角色。 角色應映射到Active Directory中的用戶組。
使用PrincipalPermissionAttribute
:
[PrincipalPermission(SecurityAction.Demand, Role = "MySpecialGroup")]
void SomeMethod()
{
// Some Code
}
角色名稱是AD組名稱。
如果您需要更多控制權,則可以使用PrincipalPermission
:
void SomeMethod()
{
if(!this.IsOwnedByCurrentUser())
{
PrincipalPermission pp = new PrincipalPermission(null, "SomeSpecialGroup");
pp.Demand();
}
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.