| | | 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 MessageSecurityOverHttpElement : ServiceModelConfigurationElement |
| | | 11 | | { |
| | | 12 | | [ConfigurationProperty(ConfigurationStrings.ClientCredentialType, DefaultValue = MessageCredentialType.Windows)] |
| | | 13 | | public MessageCredentialType ClientCredentialType |
| | | 14 | | { |
| | 2 | 15 | | get { return (MessageCredentialType)base[ConfigurationStrings.ClientCredentialType]; } |
| | 0 | 16 | | set { base[ConfigurationStrings.ClientCredentialType] = value; } |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | [ConfigurationProperty(ConfigurationStrings.NegotiateServiceCredential, DefaultValue = true)] |
| | | 20 | | public bool NegotiateServiceCredential |
| | | 21 | | { |
| | 2 | 22 | | get { return (bool)base[ConfigurationStrings.NegotiateServiceCredential]; } |
| | 0 | 23 | | set { base[ConfigurationStrings.NegotiateServiceCredential] = value; } |
| | | 24 | | } |
| | | 25 | | |
| | | 26 | | [ConfigurationProperty(ConfigurationStrings.AlgorithmSuite, DefaultValue = ConfigurationStrings.Default)] |
| | | 27 | | [TypeConverter(typeof(SecurityAlgorithmSuiteConverter))] |
| | | 28 | | public SecurityAlgorithmSuite AlgorithmSuite |
| | | 29 | | { |
| | 0 | 30 | | get { return (SecurityAlgorithmSuite)base[ConfigurationStrings.AlgorithmSuite]; } |
| | 0 | 31 | | set { base[ConfigurationStrings.AlgorithmSuite] = value; } |
| | | 32 | | } |
| | | 33 | | |
| | | 34 | | internal void ApplyConfiguration(MessageSecurityOverHttp security) |
| | | 35 | | { |
| | 2 | 36 | | if (security == null) |
| | | 37 | | { |
| | 0 | 38 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(security)); |
| | | 39 | | } |
| | | 40 | | |
| | 2 | 41 | | security.ClientCredentialType = ClientCredentialType; |
| | 2 | 42 | | security.NegotiateServiceCredential = NegotiateServiceCredential; |
| | | 43 | | |
| | 2 | 44 | | if (PropertyValueOrigin.Default != ElementInformation.Properties[ConfigurationStrings.AlgorithmSuite].ValueO |
| | | 45 | | { |
| | 0 | 46 | | security.AlgorithmSuite = AlgorithmSuite; |
| | | 47 | | } |
| | 2 | 48 | | } |
| | | 49 | | } |
| | | 50 | | } |