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);
     }
 }
Exemplo n.º 2
0
        protected bool TryLookupUri(Uri requestUri, string requestMethod, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, out HttpChannelListener listener)
        {
            UriPrefixTable <HttpChannelListener> table;

            listener = null;
            if (requestMethod == null)
            {
                requestMethod = string.Empty;
            }
            Dictionary <string, UriPrefixTable <HttpChannelListener> > addressTables = this.addressTables;
            HttpChannelListener item = null;

            if (((requestMethod.Length > 0) && addressTables.TryGetValue(requestMethod, out table)) && (table.TryLookupUri(requestUri, hostNameComparisonMode, out item) && (string.Compare(requestUri.AbsolutePath, item.Uri.AbsolutePath, StringComparison.OrdinalIgnoreCase) != 0)))
            {
                item = null;
            }
            if (addressTables.TryGetValue(string.Empty, out table) && table.TryLookupUri(requestUri, hostNameComparisonMode, out listener))
            {
                if ((item != null) && (item.Uri.AbsoluteUri.Length >= listener.Uri.AbsoluteUri.Length))
                {
                    listener = item;
                }
            }
            else
            {
                listener = item;
            }
            return(listener != null);
        }
 internal ConnectionOrientedTransportBindingElement()
 {
     this.connectionBufferSize         = 65536;
     this.hostNameComparisonMode       = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
     this.channelInitializationTimeout = Microsoft.ServiceBus.Channels.ConnectionOrientedTransportDefaults.ChannelInitializationTimeout;
     this.maxBufferSize         = 65536;
     this.maxPendingConnections = 10;
     this.maxOutputDelay        = Microsoft.ServiceBus.Channels.ConnectionOrientedTransportDefaults.MaxOutputDelay;
     this.maxPendingAccepts     = 1;
     this.transferMode          = System.ServiceModel.TransferMode.Buffered;
 }
Exemplo n.º 4
0
        internal override void Unregister(TransportChannelListener channelListener)
        {
            UriPrefixTable <HttpChannelListener> table;

            if (!this.addressTables.TryGetValue(((HttpChannelListener)channelListener).Method, out table))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(System.ServiceModel.SR.GetString("ListenerFactoryNotRegistered", new object[] { channelListener.Uri })));
            }
            System.ServiceModel.HostNameComparisonMode registeredComparisonMode = channelListener.InheritBaseAddressSettings ? this.hostNameComparisonMode : channelListener.HostNameComparisonModeInternal;
            TransportManager.EnsureRegistered <HttpChannelListener>(table, (HttpChannelListener)channelListener, registeredComparisonMode);
            table.UnregisterUri(channelListener.Uri, registeredComparisonMode);
        }
 internal ConnectionOrientedTransportBindingElement(Microsoft.ServiceBus.Channels.ConnectionOrientedTransportBindingElement elementToBeCloned) : base(elementToBeCloned)
 {
     this.connectionBufferSize         = elementToBeCloned.connectionBufferSize;
     this.exposeConnectionProperty     = elementToBeCloned.exposeConnectionProperty;
     this.hostNameComparisonMode       = elementToBeCloned.hostNameComparisonMode;
     this.inheritBaseAddressSettings   = elementToBeCloned.InheritBaseAddressSettings;
     this.channelInitializationTimeout = elementToBeCloned.ChannelInitializationTimeout;
     this.maxBufferSize            = elementToBeCloned.maxBufferSize;
     this.maxBufferSizeInitialized = elementToBeCloned.maxBufferSizeInitialized;
     this.maxPendingConnections    = elementToBeCloned.maxPendingConnections;
     this.maxOutputDelay           = elementToBeCloned.maxOutputDelay;
     this.maxPendingAccepts        = elementToBeCloned.maxPendingAccepts;
     this.transferMode             = elementToBeCloned.transferMode;
 }
 protected override bool TryGetTransportManagerRegistration(System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, out ITransportManagerRegistration registration)
 {
     if (this.TransportManagerTable.TryLookupUri(this.Uri, hostNameComparisonMode, out registration))
     {
         HttpTransportManager manager = registration as HttpTransportManager;
         if ((manager != null) && manager.IsHosted)
         {
             return(true);
         }
         if (registration.ListenUri.Segments.Length >= base.BaseUri.Segments.Length)
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 7
0
 private string ParseHostAndHostNameComparisonMode(string host)
 {
     if (string.IsNullOrEmpty(host) || host.Equals("*"))
     {
         this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.WeakWildcard;
         host = DnsCache.MachineName;
         return(host);
     }
     if (host.Equals("+"))
     {
         this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
         host = DnsCache.MachineName;
         return(host);
     }
     this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.Exact;
     return(host);
 }
        private static ServiceNameCollection GetDefaultSpnList(System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, Uri listenUri)
        {
            Dictionary <string, string> list = new Dictionary <string, string>();
            string hostName    = null;
            string dnsSafeHost = listenUri.DnsSafeHost;

            switch (hostNameComparisonMode)
            {
            case System.ServiceModel.HostNameComparisonMode.StrongWildcard:
            case System.ServiceModel.HostNameComparisonMode.WeakWildcard:
                hostName = Dns.GetHostEntry(string.Empty).HostName;
                AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { hostName }));
                AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { hostName }));
                break;

            case System.ServiceModel.HostNameComparisonMode.Exact:
            {
                UriHostNameType hostNameType = listenUri.HostNameType;
                if ((hostNameType != UriHostNameType.IPv4) && (hostNameType != UriHostNameType.IPv6))
                {
                    if (listenUri.DnsSafeHost.Contains("."))
                    {
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { dnsSafeHost }));
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { dnsSafeHost }));
                    }
                    else
                    {
                        hostName = Dns.GetHostEntry(string.Empty).HostName;
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { dnsSafeHost }));
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { dnsSafeHost }));
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { hostName }));
                        AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { hostName }));
                    }
                    break;
                }
                hostName = Dns.GetHostEntry(string.Empty).HostName;
                AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { hostName }));
                AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { hostName }));
                break;
            }
            }
            AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HOST/{0}", new object[] { "localhost" }));
            AddSpn(list, string.Format(CultureInfo.InvariantCulture, "HTTP/{0}", new object[] { "localhost" }));
            return(new ServiceNameCollection(list.Values));
        }
 public HttpTransportBindingElement()
 {
     this.allowCookies           = false;
     this.authenticationScheme   = AuthenticationSchemes.Anonymous;
     this.bypassProxyOnLocal     = false;
     this.decompressionEnabled   = true;
     this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
     this.keepAliveEnabled       = true;
     this.maxBufferSize          = 0x10000;
     this.method = string.Empty;
     this.proxyAuthenticationScheme = AuthenticationSchemes.Anonymous;
     this.proxyAddress = null;
     this.realm        = "";
     this.transferMode = System.ServiceModel.TransferMode.Buffered;
     this.unsafeConnectionNtlmAuthentication = false;
     this.useDefaultWebProxy       = true;
     this.webProxy                 = null;
     this.extendedProtectionPolicy = ChannelBindingUtility.DefaultPolicy;
 }
 private string ParseHostAndHostNameComparisonMode(string host)
 {
     if (string.IsNullOrEmpty(host) || host.Equals("*"))
     {
         this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.WeakWildcard;
         host = DnsCache.MachineName;
         return host;
     }
     if (host.Equals("+"))
     {
         this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.StrongWildcard;
         host = DnsCache.MachineName;
         return host;
     }
     this.hostNameComparisonMode = System.ServiceModel.HostNameComparisonMode.Exact;
     return host;
 }
Exemplo n.º 11
0
 internal HttpTransportManager(Uri listenUri, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode) : this()
 {
     this.hostNameComparisonMode = hostNameComparisonMode;
     this.listenUri = listenUri;
 }
 internal HttpTransportManager(Uri listenUri, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode) : this()
 {
     this.hostNameComparisonMode = hostNameComparisonMode;
     this.listenUri = listenUri;
 }
Exemplo n.º 13
0
 internal HttpTransportManager(Uri listenUri, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, string realm) : this(listenUri, hostNameComparisonMode)
 {
     this.realm = realm;
 }
 protected TransportManagerRegistration(Uri listenUri, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode)
 {
     this.listenUri = listenUri;
     this.hostNameComparisonMode = hostNameComparisonMode;
 }
 public BaseUriWithWildcard(Uri baseAddress, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode)
 {
     this.baseAddress = baseAddress;
     this.hostNameComparisonMode = hostNameComparisonMode;
     this.SetComparisonAddressAndHashCode();
 }
 protected void SetHostNameComparisonMode(System.ServiceModel.HostNameComparisonMode hostNameComparisonMode)
 {
     this.hostNameComparisonMode = hostNameComparisonMode;
 }
 private static System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy GetPolicyWithDefaultSpnCollection(System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy policy, AuthenticationSchemes authenticationScheme, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode, Uri listenUri, out bool usingDefaultSpnList)
 {
     if ((((policy.PolicyEnforcement != PolicyEnforcement.Never) && (policy.CustomServiceNames == null)) && ((policy.CustomChannelBinding == null) && (authenticationScheme != AuthenticationSchemes.Anonymous))) && string.Equals(listenUri.Scheme, Uri.UriSchemeHttp, StringComparison.OrdinalIgnoreCase))
     {
         usingDefaultSpnList = true;
         return(new System.Security.Authentication.ExtendedProtection.ExtendedProtectionPolicy(policy.PolicyEnforcement, policy.ProtectionScenario, GetDefaultSpnList(hostNameComparisonMode, listenUri)));
     }
     usingDefaultSpnList = false;
     return(policy);
 }
Exemplo n.º 18
0
 public BaseUriWithWildcard(Uri baseAddress, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode)
 {
     this.baseAddress            = baseAddress;
     this.hostNameComparisonMode = hostNameComparisonMode;
     this.SetComparisonAddressAndHashCode();
 }
 protected TransportManagerRegistration(Uri listenUri, System.ServiceModel.HostNameComparisonMode hostNameComparisonMode)
 {
     this.listenUri = listenUri;
     this.hostNameComparisonMode = hostNameComparisonMode;
 }