Пример #1
0
 void IServiceBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceDescription description, ServiceHostBase serviceHostBase)
 {
     if (description == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("description"));
     }
     if (serviceHostBase == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("serviceHostBase"));
     }
     if (this.serviceAuthenticationManager != null)
     {
         for (int i = 0; i < serviceHostBase.ChannelDispatchers.Count; i++)
         {
             ChannelDispatcher channelDispatcher = serviceHostBase.ChannelDispatchers[i] as ChannelDispatcher;
             if ((channelDispatcher != null) && !ServiceMetadataBehavior.IsHttpGetMetadataDispatcher(description, channelDispatcher))
             {
                 foreach (EndpointDispatcher dispatcher2 in channelDispatcher.Endpoints)
                 {
                     DispatchRuntime dispatchRuntime = dispatcher2.DispatchRuntime;
                     dispatchRuntime.ServiceAuthenticationManager = this.serviceAuthenticationManager;
                     ServiceEndpoint endpoint = this.FindMatchingServiceEndpoint(description, dispatcher2);
                     if ((endpoint != null) && this.IsSecureConversationBinding(endpoint.Binding))
                     {
                         SecurityStandardsManager configuredSecurityStandardsManager = this.GetConfiguredSecurityStandardsManager(endpoint.Binding);
                         dispatchRuntime.ServiceAuthenticationManager = new ServiceAuthenticationManagerWrapper(this.serviceAuthenticationManager, new string[] { configuredSecurityStandardsManager.SecureConversationDriver.CloseAction.Value });
                     }
                 }
             }
         }
     }
 }
Пример #2
0
 void IServiceBehavior.ApplyDispatchBehavior(System.ServiceModel.Description.ServiceDescription description, ServiceHostBase serviceHostBase)
 {
     if (description == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("description"));
     }
     if (serviceHostBase == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("serviceHostBase"));
     }
     for (int i = 0; i < serviceHostBase.ChannelDispatchers.Count; i++)
     {
         ChannelDispatcher channelDispatcher = serviceHostBase.ChannelDispatchers[i] as ChannelDispatcher;
         if ((channelDispatcher != null) && !ServiceMetadataBehavior.IsHttpGetMetadataDispatcher(description, channelDispatcher))
         {
             foreach (EndpointDispatcher dispatcher2 in channelDispatcher.Endpoints)
             {
                 DispatchRuntime dispatchRuntime = dispatcher2.DispatchRuntime;
                 dispatchRuntime.PrincipalPermissionMode = this.principalPermissionMode;
                 if (!dispatcher2.IsSystemEndpoint)
                 {
                     dispatchRuntime.ImpersonateCallerForAllOperations = this.impersonateCallerForAllOperations;
                 }
                 if (this.roleProvider != null)
                 {
                     this.ApplyRoleProvider(dispatchRuntime);
                 }
                 if (this.isAuthorizationManagerSet || this.isExternalPoliciesSet)
                 {
                     this.ApplyAuthorizationPoliciesAndManager(dispatchRuntime);
                 }
             }
         }
     }
 }
 void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
 {
     for (int i = 0; i < serviceHostBase.ChannelDispatchers.Count; i++)
     {
         ChannelDispatcher channelDispatcher = serviceHostBase.ChannelDispatchers[i] as ChannelDispatcher;
         if (channelDispatcher != null && !ServiceMetadataBehavior.IsHttpGetMetadataDispatcher(description, channelDispatcher))
         {
             foreach (EndpointDispatcher endpointDispatcher in channelDispatcher.Endpoints)
             {
                 DispatchRuntime behavior = endpointDispatcher.DispatchRuntime;
                 behavior.RequireClaimsPrincipalOnOperationContext = this.useIdentityConfiguration;
             }
         }
     }
 }