WebHttpSecurity.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / WebHttpSecurity.cs / 1 / WebHttpSecurity.cs

                            //------------------------------------------------------------ 
// Copyright (c) Microsoft Corporation.  All rights reserved.
//-----------------------------------------------------------
namespace System.ServiceModel
{ 
    using System.ServiceModel.Channels;
    using System.Net.Security; 
    using System.ServiceModel.Security; 
    using System.ServiceModel.Configuration;
    using System.Diagnostics; 
    using System.ServiceModel.Web;

    public sealed class WebHttpSecurity
    { 
        internal const WebHttpSecurityMode DefaultMode = WebHttpSecurityMode.None;
        WebHttpSecurityMode mode; 
        HttpTransportSecurity transportSecurity; 

        internal WebHttpSecurity() : this(DefaultMode, new HttpTransportSecurity()) 
        {
        }

        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1305:SpecifyIFormatProvider", Justification = "not needed for Fx.Assert")] 
        WebHttpSecurity(WebHttpSecurityMode mode, HttpTransportSecurity transportSecurity)
        { 
            Fx.Assert(WebHttpSecurityModeHelper.IsDefined(mode), string.Format("Invalid WebHttpSecurityMode value: {0}.", mode.ToString())); 
            this.Mode = mode;
            this.transportSecurity = transportSecurity == null ? new HttpTransportSecurity() : transportSecurity; 
        }

        public WebHttpSecurityMode Mode
        { 
            get { return this.mode; }
            set 
            { 
                if (!WebHttpSecurityModeHelper.IsDefined(value))
                { 
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentOutOfRangeException("value"));
                }
                this.mode = value;
            } 
        }
 
        public HttpTransportSecurity Transport 
        {
            get { return this.transportSecurity; } 
        }

        internal void DisableTransportAuthentication(HttpTransportBindingElement http)
        { 
            this.transportSecurity.DisableTransportAuthentication(http);
        } 
 
        internal void EnableTransportAuthentication(HttpTransportBindingElement http)
        { 
            this.transportSecurity.ConfigureTransportAuthentication(http);
        }

        internal void EnableTransportSecurity(HttpsTransportBindingElement https) 
        {
            this.transportSecurity.ConfigureTransportProtectionAndAuthentication(https); 
        } 
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK