Ejemplo n.º 1
0
        internal TransportBindingElement GetTransport()
        {
            Fx.Assert(this.BasicHttpSecurity != null, "this.BasicHttpSecurity should not return null from a derived class.");

            BasicHttpSecurity basicHttpSecurity = BasicHttpSecurity;

            if (basicHttpSecurity.Mode == BasicHttpSecurityMode.TransportWithMessageCredential || basicHttpSecurity.Mode == BasicHttpSecurityMode.Message)
            {
                throw new PlatformNotSupportedException(nameof(BasicHttpSecurityMode.TransportWithMessageCredential));
            }
            else if (basicHttpSecurity.Mode == BasicHttpSecurityMode.Transport)
            {
                basicHttpSecurity.EnableTransportSecurity(_httpsTransport);
                return(_httpsTransport);
            }
            else if (basicHttpSecurity.Mode == BasicHttpSecurityMode.TransportCredentialOnly)
            {
                basicHttpSecurity.EnableTransportAuthentication(_httpTransport);
                return(_httpTransport);
            }
            else
            {
                // ensure that there is no transport security
                basicHttpSecurity.DisableTransportAuthentication(_httpTransport);
                return(_httpTransport);
            }
        }
Ejemplo n.º 2
0
 private void Initialize()
 {
     _basicHttpSecurity = new BasicHttpSecurity();
 }