ServiceAuthorizationBehavior.ServiceAuthorizationManager Property

 

Gets or sets the service authorization manager.

Namespace:   System.ServiceModel.Description
Assembly:  System.ServiceModel (in System.ServiceModel.dll)

public ServiceAuthorizationManager ServiceAuthorizationManager { get; set; }

Property Value

Type: System.ServiceModel.ServiceAuthorizationManager

The service authorization manager.

The ServiceAuthorizationManager class is responsible for evaluating all policies, chaining forward and backward, optionally connecting the resulting AuthorizationContext to the ServiceSecurityContext and returning the authorization decision of true or false to allow or deny access.

The following code shows how to set this property to use a custom service authorization manager.

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;

.NET Framework
Available since 3.0
Return to top
Show: