共用方式為


ServiceAuthorizationBehavior.ExternalAuthorizationPolicies 屬性

定義

取得或設定外部授權原則的集合。

public:
 property System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Policy::IAuthorizationPolicy ^> ^ ExternalAuthorizationPolicies { System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Policy::IAuthorizationPolicy ^> ^ get(); void set(System::Collections::ObjectModel::ReadOnlyCollection<System::IdentityModel::Policy::IAuthorizationPolicy ^> ^ value); };
public System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Policy.IAuthorizationPolicy> ExternalAuthorizationPolicies { get; set; }
member this.ExternalAuthorizationPolicies : System.Collections.ObjectModel.ReadOnlyCollection<System.IdentityModel.Policy.IAuthorizationPolicy> with get, set
Public Property ExternalAuthorizationPolicies As ReadOnlyCollection(Of IAuthorizationPolicy)

屬性值

ReadOnlyCollection<IAuthorizationPolicy>

外部授權原則的集合。

例外狀況

行為是唯讀的。

範例

下列程式碼會示範如何設定此屬性,以使用一組外部授權原則。

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

備註

外部授權原則會參與產生使用者 ServiceSecurityContext 的原則評估程序。

適用於