ServiceAuthorizationBehavior.ServiceAuthorizationManager 属性

定义

获取或设置服务授权管理器。

public:
 property System::ServiceModel::ServiceAuthorizationManager ^ ServiceAuthorizationManager { System::ServiceModel::ServiceAuthorizationManager ^ get(); void set(System::ServiceModel::ServiceAuthorizationManager ^ value); };
public System.ServiceModel.ServiceAuthorizationManager ServiceAuthorizationManager { get; set; }
member this.ServiceAuthorizationManager : System.ServiceModel.ServiceAuthorizationManager with get, set
Public Property ServiceAuthorizationManager As ServiceAuthorizationManager

属性值

服务授权管理器。

示例

以下代码演示如何将此属性设置为使用自定义服务授权管理器。

ServiceHost myServiceHost = new ServiceHost(typeof(Calculator), baseUri);
ServiceAuthorizationBehavior myServiceBehavior =
    myServiceHost.Description.Behaviors.Find<ServiceAuthorizationBehavior>();
myServiceBehavior.PrincipalPermissionMode =
    PrincipalPermissionMode.UseAspNetRoles;
MyServiceAuthorizationManager sm = new MyServiceAuthorizationManager();
myServiceBehavior.ServiceAuthorizationManager = sm;
Dim myServiceHost As New ServiceHost(GetType(Calculator), baseUri)
Dim myServiceBehavior As ServiceAuthorizationBehavior = myServiceHost.Description.Behaviors.Find(Of ServiceAuthorizationBehavior)()
myServiceBehavior.PrincipalPermissionMode = PrincipalPermissionMode.UseAspNetRoles
Dim sm As New MyServiceAuthorizationManager()
myServiceBehavior.ServiceAuthorizationManager = sm

注解

ServiceAuthorizationManager 类负责评估所有策略、向前和向后链接、选择将结果 AuthorizationContext 连接到 ServiceSecurityContext 结果以及返回授权决策 truefalse 允许或拒绝访问。

适用于

另请参阅