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