public static void Configure(ServiceHostBase serviceHost, ServiceAuthenticationManager authenticationManager, IEnumerable <IAuthorizationPolicy> authorizationPolicies, IOperationBehavior authorizationInvokerBehavior, IServiceBehavior errorBehavior) { SetAuthentication(serviceHost, authenticationManager, authorizationPolicies); SetAuthorizationInvokerBehavior(serviceHost, authorizationInvokerBehavior); SetErrorHandlers(serviceHost, errorBehavior); }
private static void SetAuthentication(ServiceHostBase serviceHost, ServiceAuthenticationManager authenticationManager, IEnumerable <IAuthorizationPolicy> authorizationPolicies) { serviceHost.Authorization.PrincipalPermissionMode = PrincipalPermissionMode.Custom; serviceHost.Authentication.ServiceAuthenticationManager = authenticationManager; serviceHost.Authorization.ExternalAuthorizationPolicies = authorizationPolicies.ToList().AsReadOnly(); }
ServiceAuthenticationBehavior(ServiceAuthenticationBehavior other) { this.serviceAuthenticationManager = other.ServiceAuthenticationManager; this.authenticationSchemes = other.authenticationSchemes; this.isReadOnly = other.isReadOnly; this.isAuthenticationManagerSet = other.isAuthenticationManagerSet; this.isAuthenticationSchemesSet = other.isAuthenticationSchemesSet; }
void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collection <ServiceEndpoint> endpoints, BindingParameterCollection parameters) { if (parameters == null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("parameters"); } if (this.serviceAuthenticationManager != null) { // throw if bindingParameters already has a AuthenticationManager ServiceAuthenticationManager otherAuthenticationManager = parameters.Find <ServiceAuthenticationManager>(); if (otherAuthenticationManager != null) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MultipleAuthenticationManagersInServiceBindingParameters, otherAuthenticationManager))); } parameters.Add(this.serviceAuthenticationManager); } if (this.authenticationSchemes != AuthenticationSchemes.None) { // throw if bindingParameters already has an AuthenticationSchemes AuthenticationSchemesBindingParameter otherAuthenticationSchemesBindingParameter = parameters.Find <AuthenticationSchemesBindingParameter>(); if (otherAuthenticationSchemesBindingParameter != null) { if (otherAuthenticationSchemesBindingParameter.AuthenticationSchemes != authenticationSchemes) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.MultipleAuthenticationSchemesInServiceBindingParameters, otherAuthenticationSchemesBindingParameter.AuthenticationSchemes))); } } else { parameters.Add(new AuthenticationSchemesBindingParameter(this.authenticationSchemes)); } } }
AuthenticationBehavior(ServiceAuthenticationManager authenticationManager) { this.serviceAuthenticationManager = authenticationManager; }
private AuthenticationBehavior(ServiceAuthenticationManager authenticationManager) { this.serviceAuthenticationManager = authenticationManager; }
AuthenticationBehavior(ServiceAuthenticationManager authenticationManager) { _serviceAuthenticationManager = authenticationManager; }