| | | 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.Configuration; |
| | | 5 | | using System.Security.Authentication; |
| | | 6 | | using CoreWCF.Channels; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Configuration |
| | | 9 | | { |
| | | 10 | | public class TcpTransportSecurityElement : ServiceModelConfigurationElement |
| | | 11 | | { |
| | | 12 | | [ConfigurationProperty(ConfigurationStrings.ClientCredentialType, DefaultValue = TcpClientCredentialType.Windows |
| | | 13 | | public TcpClientCredentialType ClientCredentialType |
| | | 14 | | { |
| | 9 | 15 | | get { return (TcpClientCredentialType)base[ConfigurationStrings.ClientCredentialType]; } |
| | 0 | 16 | | set { base[ConfigurationStrings.ClientCredentialType] = value; } |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | //[ConfigurationProperty(ConfigurationStrings.ProtectionLevel, DefaultValue = TcpTransportSecurity.DefaultProtec |
| | | 20 | | //[ServiceModelEnumValidator(typeof(ProtectionLevelHelper))] |
| | | 21 | | //public ProtectionLevel ProtectionLevel |
| | | 22 | | //{ |
| | | 23 | | // get { return (ProtectionLevel)base[ConfigurationStrings.ProtectionLevel]; } |
| | | 24 | | // set { base[ConfigurationStrings.ProtectionLevel] = value; } |
| | | 25 | | //} |
| | | 26 | | |
| | | 27 | | //[ConfigurationProperty(ConfigurationStrings.ExtendedProtectionPolicy)] |
| | | 28 | | //public ExtendedProtectionPolicyElement ExtendedProtectionPolicy |
| | | 29 | | //{ |
| | | 30 | | // get { return (ExtendedProtectionPolicyElement)base[ConfigurationStrings.ExtendedProtectionPolicy]; } |
| | | 31 | | // private set { base[ConfigurationStrings.ExtendedProtectionPolicy] = value; } |
| | | 32 | | //} |
| | | 33 | | |
| | | 34 | | [ConfigurationProperty(ConfigurationStrings.SslProtocols, DefaultValue = SslProtocols.None)] |
| | | 35 | | public SslProtocols SslProtocols |
| | | 36 | | { |
| | 9 | 37 | | get { return (SslProtocols)base[ConfigurationStrings.SslProtocols]; } |
| | 0 | 38 | | private set { base[ConfigurationStrings.SslProtocols] = value; } |
| | | 39 | | } |
| | | 40 | | |
| | | 41 | | internal void ApplyConfiguration(TcpTransportSecurity security) |
| | | 42 | | { |
| | 9 | 43 | | if (security == null) |
| | | 44 | | { |
| | 0 | 45 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(security)); |
| | | 46 | | } |
| | | 47 | | |
| | 9 | 48 | | security.ClientCredentialType = ClientCredentialType; |
| | | 49 | | //security.ProtectionLevel = this.ProtectionLevel; |
| | | 50 | | //security.ExtendedProtectionPolicy = ChannelBindingUtility.BuildPolicy(this.ExtendedProtectionPolicy); |
| | 9 | 51 | | security.SslProtocols = SslProtocols; |
| | 9 | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |