| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System; |
| | | 5 | | using System.Configuration; |
| | | 6 | | using System.Net.Security; |
| | | 7 | | using CoreWCF.Channels; |
| | | 8 | | |
| | | 9 | | namespace CoreWCF.Configuration |
| | | 10 | | { |
| | | 11 | | public sealed class WindowsStreamSecurityElement : BindingElementExtensionElement |
| | | 12 | | { |
| | 0 | 13 | | public WindowsStreamSecurityElement() |
| | | 14 | | { |
| | 0 | 15 | | } |
| | | 16 | | |
| | | 17 | | [ConfigurationProperty(ConfigurationStrings.ProtectionLevel, DefaultValue = ConnectionOrientedTransportDefaults. |
| | | 18 | | public ProtectionLevel ProtectionLevel |
| | | 19 | | { |
| | 0 | 20 | | get { return (ProtectionLevel)base[ConfigurationStrings.ProtectionLevel]; } |
| | 0 | 21 | | set { base[ConfigurationStrings.ProtectionLevel] = value; } |
| | | 22 | | } |
| | | 23 | | |
| | | 24 | | public override void ApplyConfiguration(BindingElement bindingElement) |
| | | 25 | | { |
| | 0 | 26 | | base.ApplyConfiguration(bindingElement); |
| | 0 | 27 | | WindowsStreamSecurityBindingElement windowsBindingElement = |
| | 0 | 28 | | (WindowsStreamSecurityBindingElement)bindingElement; |
| | 0 | 29 | | windowsBindingElement.ProtectionLevel = ProtectionLevel; |
| | 0 | 30 | | } |
| | | 31 | | |
| | | 32 | | protected internal override BindingElement CreateBindingElement() |
| | | 33 | | { |
| | 0 | 34 | | WindowsStreamSecurityBindingElement windowsBindingElement |
| | 0 | 35 | | = new WindowsStreamSecurityBindingElement(); |
| | | 36 | | |
| | 0 | 37 | | ApplyConfiguration(windowsBindingElement); |
| | 0 | 38 | | return windowsBindingElement; |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | public override Type BindingElementType |
| | | 42 | | { |
| | 0 | 43 | | get { return typeof(WindowsStreamSecurityBindingElement); } |
| | | 44 | | } |
| | | 45 | | |
| | | 46 | | public override void CopyFrom(ServiceModelExtensionElement from) |
| | | 47 | | { |
| | 0 | 48 | | base.CopyFrom(from); |
| | | 49 | | |
| | 0 | 50 | | WindowsStreamSecurityElement source = (WindowsStreamSecurityElement)from; |
| | 0 | 51 | | ProtectionLevel = source.ProtectionLevel; |
| | 0 | 52 | | } |
| | | 53 | | |
| | | 54 | | protected internal override void InitializeFrom(BindingElement bindingElement) |
| | | 55 | | { |
| | 0 | 56 | | base.InitializeFrom(bindingElement); |
| | 0 | 57 | | WindowsStreamSecurityBindingElement windowsBindingElement |
| | 0 | 58 | | = (WindowsStreamSecurityBindingElement)bindingElement; |
| | 0 | 59 | | SetPropertyValueIfNotDefaultValue(ConfigurationStrings.ProtectionLevel, windowsBindingElement.ProtectionLeve |
| | 0 | 60 | | } |
| | | 61 | | } |
| | | 62 | | } |