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
的授權決策以允許或拒絕存取。