コード例 #1
0
ファイル: HttpBindingBase.cs プロジェクト: yukozh/wcf
        internal static bool GetSecurityModeFromTransport(HttpTransportBindingElement http, HttpTransportSecurity transportSecurity, out UnifiedSecurityMode mode)
        {
            mode = UnifiedSecurityMode.None;
            if (http == null)
            {
                return(false);
            }

            Fx.Assert(http.AuthenticationScheme.IsSingleton(), "authenticationScheme used in an Http(s)ChannelFactory must be a singleton value.");

            if (http is HttpsTransportBindingElement)
            {
                mode = UnifiedSecurityMode.Transport | UnifiedSecurityMode.TransportWithMessageCredential;
                BasicHttpSecurity.EnableTransportSecurity((HttpsTransportBindingElement)http, transportSecurity);
            }
            else if (HttpTransportSecurity.IsDisabledTransportAuthentication(http))
            {
                mode = UnifiedSecurityMode.Message | UnifiedSecurityMode.None;
            }
            else if (!BasicHttpSecurity.IsEnabledTransportAuthentication(http, transportSecurity))
            {
                return(false);
            }
            else
            {
                mode = UnifiedSecurityMode.TransportCredentialOnly;
            }

            return(true);
        }
コード例 #2
0
 private static bool GetSecurityModeFromTransport(HttpTransportBindingElement http, HttpTransportSecurity transportSecurity, out UnifiedSecurityMode mode)
 {
     mode = UnifiedSecurityMode.None;
     if (http == null)
     {
         return(false);
     }
     if (http is HttpsTransportBindingElement)
     {
         mode = UnifiedSecurityMode.TransportWithMessageCredential | UnifiedSecurityMode.Transport;
         BasicHttpSecurity.EnableTransportSecurity((HttpsTransportBindingElement)http, transportSecurity);
     }
     else if (HttpTransportSecurity.IsDisabledTransportAuthentication(http))
     {
         mode = UnifiedSecurityMode.Message | UnifiedSecurityMode.None;
     }
     else
     {
         if (!BasicHttpSecurity.IsEnabledTransportAuthentication(http, transportSecurity))
         {
             return(false);
         }
         mode = UnifiedSecurityMode.TransportCredentialOnly;
     }
     return(true);
 }