PageRenderTime 17ms CodeModel.GetById 13ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

/ExpressInteropBinding/Microsoft.ServiceModel.Interop/WebLogic/Configuration/WebLogicSecurityElement.cs

#
C# | 73 lines | 39 code | 11 blank | 23 comment | 0 complexity | 6e9b36237341108a9c802120f24e66a4 MD5 | raw file
 1// <copyright file="WebLogicSecurityElement.cs" company="Microsoft Corporation">
 2// Copyright (c) Microsoft Corporation.  All rights reserved.
 3// </copyright>
 4
 5namespace Microsoft.ServiceModel.Interop.WebLogic.Configuration
 6{
 7    using System.Configuration;
 8    using Microsoft.ServiceModel.Interop.Configuration;
 9
10    /// <summary>
11    /// WebLogic security configuration element
12    /// </summary>
13    public class WebLogicSecurityElement : InteropSecurityElement
14    {
15        private const string ModeProperty = "mode";
16
17        /// <summary>
18        /// Initializes a new instance of the WebLogicSecurityElement class
19        /// </summary>
20        public WebLogicSecurityElement()
21        {
22        }
23
24        /// <summary>
25        /// Gets or sets the security mode
26        /// </summary>
27        [ConfigurationProperty(ModeProperty, IsRequired = true)]
28        public WebLogicSecurityMode Mode
29        {
30            get { return (WebLogicSecurityMode)base[ModeProperty]; }
31            set { base[ModeProperty] = value; }
32        }
33
34        /// <summary>
35        /// Gets all the available configuration properties
36        /// </summary>
37        protected override ConfigurationPropertyCollection Properties
38        {
39            get
40            {
41                ConfigurationPropertyCollection properties = base.Properties;
42                properties.Add(new ConfigurationProperty(ModeProperty, typeof(WebLogicSecurityMode), WebLogicSecurityMode.UserNameOverCertificate, ConfigurationPropertyOptions.IsRequired));
43
44                return properties;
45            }
46        }
47
48        /// <summary>
49        /// Applies this configuration element to an existing security binding element
50        /// </summary>
51        /// <param name="security">Security binding element</param>
52        public override void ApplyConfiguration(InteropSecurity security)
53        {
54            base.ApplyConfiguration(security);
55
56            WebLogicSecurity webLogicSecurity = (WebLogicSecurity)security;
57            webLogicSecurity.Mode = this.Mode;
58        }
59
60        /// <summary>
61        /// Initializes this configuration element from an existing security binding element
62        /// </summary>
63        /// <param name="security">Security binding element</param>
64        public override void InitializeFrom(InteropSecurity security)
65        {
66            base.InitializeFrom(security);
67
68            WebLogicSecurity webLogicSecurity = (WebLogicSecurity)security;
69            this.Mode = webLogicSecurity.Mode;
70        }
71    }
72}
73