ServiceAuthorizationBehavior.PrincipalPermissionMode 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置主体权限模式。
public:
property System::ServiceModel::Description::PrincipalPermissionMode PrincipalPermissionMode { System::ServiceModel::Description::PrincipalPermissionMode get(); void set(System::ServiceModel::Description::PrincipalPermissionMode value); };
public System.ServiceModel.Description.PrincipalPermissionMode PrincipalPermissionMode { get; set; }
member this.PrincipalPermissionMode : System.ServiceModel.Description.PrincipalPermissionMode with get, set
Public Property PrincipalPermissionMode As PrincipalPermissionMode
属性值
主体权限模式。
示例
此代码演示如何设置此属性。
ServiceHost myServiceHost = new ServiceHost(typeof(Calculator), baseUri);
ServiceAuthorizationBehavior myServiceBehavior =
myServiceHost.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode =
PrincipalPermissionMode.UseAspNetRoles;
Dim myServiceBehavior As ServiceAuthorizationBehavior
myServiceBehavior = _
myServiceHost.Description.Behaviors.Find(Of ServiceAuthorizationBehavior)()
myServiceBehavior.PrincipalPermissionMode = _
PrincipalPermissionMode.UseAspNetRoles
注解
此属性包含 PrincipalPermissionMode 枚举的成员之一。 有效值是:
Custom. 自定义
IAuthorizationPolicy
实现用于填充Thread.CurrentPrincipal
。None. 未设置
Thread.CurrentPrincipal
属性。UseAspNetRoles. 根据 ASP.NET 角色信息将
Thread.CurrentPrincipal
属性设置为IPrincipal
。UseWindowsGroups. 根据传入消息的用户凭据,将
Thread.CurrentPrincipal
属性设置为WindowsPrincipal
。