| | | 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.ComponentModel; |
| | | 5 | | using System.Configuration; |
| | | 6 | | using CoreWCF.Security; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Configuration |
| | | 9 | | { |
| | | 10 | | public class BasicHttpMessageSecurityElement : ServiceModelConfigurationElement |
| | | 11 | | { |
| | | 12 | | internal const BasicHttpMessageCredentialType DefaultClientCredentialType = BasicHttpMessageCredentialType.UserN |
| | | 13 | | |
| | | 14 | | [ConfigurationProperty(ConfigurationStrings.ClientCredentialType, DefaultValue = DefaultClientCredentialType)] |
| | | 15 | | public BasicHttpMessageCredentialType ClientCredentialType |
| | | 16 | | { |
| | 6 | 17 | | get { return (BasicHttpMessageCredentialType)base[ConfigurationStrings.ClientCredentialType]; } |
| | 0 | 18 | | set { base[ConfigurationStrings.ClientCredentialType] = value; } |
| | | 19 | | } |
| | | 20 | | |
| | | 21 | | [ConfigurationProperty(ConfigurationStrings.AlgorithmSuite, DefaultValue = ConfigurationStrings.Default)] |
| | | 22 | | [TypeConverter(typeof(SecurityAlgorithmSuiteConverter))] |
| | | 23 | | public SecurityAlgorithmSuite AlgorithmSuite |
| | | 24 | | { |
| | 0 | 25 | | get { return (SecurityAlgorithmSuite)base[ConfigurationStrings.AlgorithmSuite]; } |
| | 0 | 26 | | set { base[ConfigurationStrings.AlgorithmSuite] = value; } |
| | | 27 | | } |
| | | 28 | | |
| | | 29 | | internal void ApplyConfiguration(BasicHttpMessageSecurity security) |
| | | 30 | | { |
| | 6 | 31 | | if (security == null) |
| | | 32 | | { |
| | 0 | 33 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(security)); |
| | | 34 | | } |
| | | 35 | | |
| | 6 | 36 | | security.ClientCredentialType = ClientCredentialType; |
| | | 37 | | |
| | 6 | 38 | | if (PropertyValueOrigin.Default != ElementInformation.Properties[ConfigurationStrings.AlgorithmSuite].ValueO |
| | | 39 | | { |
| | 0 | 40 | | security.AlgorithmSuite = AlgorithmSuite; |
| | | 41 | | } |
| | 6 | 42 | | } |
| | | 43 | | } |
| | | 44 | | } |