PageRenderTime 22ms CodeModel.GetById 14ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/WCFWebApi/src/Microsoft.ApplicationServer.Http/Microsoft/ApplicationServer/Http/HttpBindingSecurity.cs

#
C# | 69 lines | 42 code | 9 blank | 18 comment | 0 complexity | 9f454a0c644b0ca6c594a9920ee9dc12 MD5 | raw file
 1// <copyright>
 2//   Copyright (c) Microsoft Corporation.  All rights reserved.
 3// </copyright>
 4
 5namespace Microsoft.ApplicationServer.Http
 6{
 7    using System.ComponentModel;
 8    using System.ServiceModel;
 9    using Microsoft.Server.Common;
10
11    /// <summary>
12    /// Specifies the types of security available to a service endpoint configured to use an
13    /// <see cref="HttpBinding"/> binding.
14    /// </summary>
15    public sealed class HttpBindingSecurity
16    {
17        internal const HttpBindingSecurityMode DefaultMode = HttpBindingSecurityMode.None;
18        
19        private HttpBindingSecurityMode mode;
20        private HttpTransportSecurity transportSecurity;
21
22        /// <summary>
23        /// Creates a new instance of the <see cref="HttpBindingSecurity"/> class.
24        /// </summary>
25        public HttpBindingSecurity()
26        {
27            this.mode = DefaultMode;
28            this.transportSecurity = new HttpTransportSecurity();
29        }
30
31        /// <summary>
32        /// Gets or sets the mode of security that is used by an endpoint configured to use an
33        /// <see cref="HttpBinding"/> binding.
34        /// </summary>
35        public HttpBindingSecurityMode Mode
36        {
37            get 
38            { 
39                return this.mode; 
40            }
41
42            set
43            {
44                HttpBindingSecurityModeHelper.Validate(value, "value");
45                this.IsModeSet = true;
46                this.mode = value;
47            }
48        }
49
50        /// <summary>
51        /// Gets or sets an object that contains the transport-level security settings for the 
52        /// <see cref="HttpBinding"/> binding.
53        /// </summary>
54        public HttpTransportSecurity Transport
55        {
56            get 
57            { 
58                return this.transportSecurity; 
59            }
60
61            set
62            {
63                this.transportSecurity = value ?? new HttpTransportSecurity();
64            }
65        }
66
67        internal bool IsModeSet { get; private set; }
68    }
69}