ServiceAuthorizationBehavior.ServiceAuthorizationManager 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置服务授权管理器。
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 并返回 true
或 false
的授权决定,以允许或拒绝访问。