internal HttpAnonymousUriPrefixMatcher(HttpAnonymousUriPrefixMatcher objectToClone) : this()
 {
     if (objectToClone.anonymousUriPrefixes != null)
     {
         this.anonymousUriPrefixes = new UriPrefixTable <Uri>(objectToClone.anonymousUriPrefixes);
     }
 }
 protected HttpTransportBindingElement(HttpTransportBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.allowCookies               = elementToBeCloned.allowCookies;
     this.authenticationScheme       = elementToBeCloned.authenticationScheme;
     this.bypassProxyOnLocal         = elementToBeCloned.bypassProxyOnLocal;
     this.decompressionEnabled       = elementToBeCloned.decompressionEnabled;
     this.hostNameComparisonMode     = elementToBeCloned.hostNameComparisonMode;
     this.inheritBaseAddressSettings = elementToBeCloned.InheritBaseAddressSettings;
     this.keepAliveEnabled           = elementToBeCloned.keepAliveEnabled;
     this.maxBufferSize              = elementToBeCloned.maxBufferSize;
     this.maxBufferSizeInitialized   = elementToBeCloned.maxBufferSizeInitialized;
     this.method       = elementToBeCloned.method;
     this.proxyAddress = elementToBeCloned.proxyAddress;
     this.proxyAuthenticationScheme = elementToBeCloned.proxyAuthenticationScheme;
     this.realm        = elementToBeCloned.realm;
     this.transferMode = elementToBeCloned.transferMode;
     this.unsafeConnectionNtlmAuthentication = elementToBeCloned.unsafeConnectionNtlmAuthentication;
     this.useDefaultWebProxy       = elementToBeCloned.useDefaultWebProxy;
     this.webProxy                 = elementToBeCloned.webProxy;
     this.extendedProtectionPolicy = elementToBeCloned.ExtendedProtectionPolicy;
     if (elementToBeCloned.anonymousUriPrefixMatcher != null)
     {
         this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(elementToBeCloned.anonymousUriPrefixMatcher);
     }
 }
 internal HttpAnonymousUriPrefixMatcher(HttpAnonymousUriPrefixMatcher objectToClone) : this()
 {
     if (objectToClone.anonymousUriPrefixes != null)
     {
         this.anonymousUriPrefixes = new UriPrefixTable<Uri>(objectToClone.anonymousUriPrefixes);
     }
 }
Example #4
0
        public override T GetProperty <T>(BindingContext context)
        {
            if (context == null)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
            }
            if (typeof(T) == typeof(ISecurityCapabilities))
            {
                AuthenticationSchemes effectiveAuthenticationSchemes = HttpTransportBindingElement.GetEffectiveAuthenticationSchemes(this.AuthenticationScheme,
                                                                                                                                     context.BindingParameters);

                return((T)(object)new SecurityCapabilities(this.GetSupportsClientAuthenticationImpl(effectiveAuthenticationSchemes),
                                                           effectiveAuthenticationSchemes == AuthenticationSchemes.Negotiate,
                                                           this.GetSupportsClientWindowsIdentityImpl(effectiveAuthenticationSchemes),
                                                           ProtectionLevel.None,
                                                           ProtectionLevel.None));
            }
            else if (typeof(T) == typeof(IBindingDeliveryCapabilities))
            {
                return((T)(object)new BindingDeliveryCapabilitiesHelper());
            }
            else if (typeof(T) == typeof(TransferMode))
            {
                return((T)(object)this.TransferMode);
            }
            else if (typeof(T) == typeof(ExtendedProtectionPolicy))
            {
                return((T)(object)this.ExtendedProtectionPolicy);
            }
            else if (typeof(T) == typeof(IAnonymousUriPrefixMatcher))
            {
                if (this.anonymousUriPrefixMatcher == null)
                {
                    this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher();
                }

                return((T)(object)this.anonymousUriPrefixMatcher);
            }
            else if (typeof(T) == typeof(ITransportCompressionSupport))
            {
                return((T)(object)new TransportCompressionSupportHelper());
            }
            else
            {
#pragma warning suppress 56506 // Microsoft, BindingContext.BindingParameters cannot be null
                if (context.BindingParameters.Find <MessageEncodingBindingElement>() == null)
                {
                    context.BindingParameters.Add(new TextMessageEncodingBindingElement());
                }
                return(base.GetProperty <T>(context));
            }
        }
 public HttpChannelListener(HttpTransportBindingElement bindingElement, BindingContext context) : base(bindingElement, context, HttpTransportDefaults.GetDefaultMessageEncoderFactory(), bindingElement.HostNameComparisonMode)
 {
     if (bindingElement.TransferMode == System.ServiceModel.TransferMode.Buffered)
     {
         if (bindingElement.MaxReceivedMessageSize > 0x7fffffffL)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("bindingElement.MaxReceivedMessageSize", System.ServiceModel.SR.GetString("MaxReceivedMessageSizeMustBeInIntegerRange")));
         }
         if (bindingElement.MaxBufferSize != bindingElement.MaxReceivedMessageSize)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustMatchMaxReceivedMessageSize"));
         }
     }
     else if (bindingElement.MaxBufferSize > bindingElement.MaxReceivedMessageSize)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("MaxBufferSizeMustNotExceedMaxReceivedMessageSize"));
     }
     if ((bindingElement.AuthenticationScheme == AuthenticationSchemes.Basic) && (bindingElement.ExtendedProtectionPolicy.PolicyEnforcement == PolicyEnforcement.Always))
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new NotSupportedException(System.ServiceModel.SR.GetString("ExtendedProtectionPolicyBasicAuthNotSupported")));
     }
     this.authenticationScheme       = bindingElement.AuthenticationScheme;
     this.keepAliveEnabled           = bindingElement.KeepAliveEnabled;
     base.InheritBaseAddressSettings = bindingElement.InheritBaseAddressSettings;
     this.maxBufferSize = bindingElement.MaxBufferSize;
     this.method        = bindingElement.Method;
     this.realm         = bindingElement.Realm;
     this.transferMode  = bindingElement.TransferMode;
     this.unsafeConnectionNtlmAuthentication = bindingElement.UnsafeConnectionNtlmAuthentication;
     this.credentialProvider       = context.BindingParameters.Find <SecurityCredentialsManager>();
     this.acceptor                 = new TransportReplyChannelAcceptor(this);
     this.securityCapabilities     = bindingElement.GetProperty <ISecurityCapabilities>(context);
     this.extendedProtectionPolicy = GetPolicyWithDefaultSpnCollection(bindingElement.ExtendedProtectionPolicy, this.authenticationScheme, base.HostNameComparisonModeInternal, base.Uri, out this.usingDefaultSpnList);
     if (bindingElement.AnonymousUriPrefixMatcher != null)
     {
         this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher(bindingElement.AnonymousUriPrefixMatcher);
     }
 }
 public override T GetProperty <T>(BindingContext context) where T : class
 {
     if (context == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("context");
     }
     if (typeof(T) == typeof(ISecurityCapabilities))
     {
         return((T) new SecurityCapabilities(this.SupportsClientAuthenticationImpl, this.AuthenticationScheme == AuthenticationSchemes.Negotiate, this.SupportsClientWindowsIdentityImpl, ProtectionLevel.None, ProtectionLevel.None));
     }
     if (typeof(T) == typeof(IBindingDeliveryCapabilities))
     {
         return((T) new BindingDeliveryCapabilitiesHelper());
     }
     if (typeof(T) == typeof(System.ServiceModel.TransferMode))
     {
         return((T)this.TransferMode);
     }
     if (typeof(T) == typeof(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy))
     {
         return((T)this.ExtendedProtectionPolicy);
     }
     if (typeof(T) == typeof(IAnonymousUriPrefixMatcher))
     {
         if (this.anonymousUriPrefixMatcher == null)
         {
             this.anonymousUriPrefixMatcher = new HttpAnonymousUriPrefixMatcher();
         }
         return((T)this.anonymousUriPrefixMatcher);
     }
     if (context.BindingParameters.Find <MessageEncodingBindingElement>() == null)
     {
         context.BindingParameters.Add(new TextMessageEncodingBindingElement());
     }
     return(base.GetProperty <T>(context));
 }