| | | 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 | | |
| | | 6 | | namespace CoreWCF.Configuration |
| | | 7 | | { |
| | | 8 | | public class WSHttpTransportSecurityElement : ServiceModelConfigurationElement |
| | | 9 | | { |
| | | 10 | | [ConfigurationProperty(ConfigurationStrings.ClientCredentialType, DefaultValue = HttpClientCredentialType.Window |
| | | 11 | | public HttpClientCredentialType ClientCredentialType |
| | | 12 | | { |
| | 2 | 13 | | get { return (HttpClientCredentialType)base[ConfigurationStrings.ClientCredentialType]; } |
| | 0 | 14 | | set { base[ConfigurationStrings.ClientCredentialType] = value; } |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | //[ConfigurationProperty(ConfigurationStrings.ExtendedProtectionPolicy)] |
| | | 18 | | //public ExtendedProtectionPolicyElement ExtendedProtectionPolicy |
| | | 19 | | //{ |
| | | 20 | | // get { return (ExtendedProtectionPolicyElement)base[ConfigurationStrings.ExtendedProtectionPolicy]; } |
| | | 21 | | // private set { base[ConfigurationStrings.ExtendedProtectionPolicy] = value; } |
| | | 22 | | //} |
| | | 23 | | |
| | | 24 | | [ConfigurationProperty(ConfigurationStrings.Realm, DefaultValue = "")] |
| | | 25 | | [StringValidator(MinLength = 0)] |
| | | 26 | | public string Realm |
| | | 27 | | { |
| | 2 | 28 | | get { return (string)base[ConfigurationStrings.Realm]; } |
| | | 29 | | set |
| | | 30 | | { |
| | 0 | 31 | | if (string.IsNullOrEmpty(value)) |
| | | 32 | | { |
| | 0 | 33 | | value = string.Empty; |
| | | 34 | | } |
| | 0 | 35 | | base[ConfigurationStrings.Realm] = value; |
| | 0 | 36 | | } |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | internal void ApplyConfiguration(HttpTransportSecurity security) |
| | | 40 | | { |
| | 2 | 41 | | if (security == null) |
| | | 42 | | { |
| | 0 | 43 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(security)); |
| | | 44 | | } |
| | | 45 | | |
| | 2 | 46 | | security.ClientCredentialType = ClientCredentialType; |
| | 2 | 47 | | security.Realm = Realm; |
| | | 48 | | // security.ExtendedProtectionPolicy = ChannelBindingUtility.BuildPolicy(this.ExtendedProtectionPolicy); |
| | 2 | 49 | | } |
| | | 50 | | } |
| | | 51 | | } |