PeerTransportSecurityElement.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System.Configuration;
  7. using System.Globalization;
  8. using System.Net;
  9. using System.Net.Security;
  10. using System.ServiceModel;
  11. using System.ServiceModel.Channels;
  12. using System.ServiceModel.Security;
  13. using System.ComponentModel;
  14. public sealed partial class PeerTransportSecurityElement : ServiceModelConfigurationElement
  15. {
  16. [ConfigurationProperty(ConfigurationStrings.PeerTransportCredentialType, DefaultValue = PeerTransportSecuritySettings.DefaultCredentialType)]
  17. [ServiceModelEnumValidator(typeof(PeerTransportCredentialTypeHelper))]
  18. public PeerTransportCredentialType CredentialType
  19. {
  20. get { return (PeerTransportCredentialType)base[ConfigurationStrings.PeerTransportCredentialType]; }
  21. set { base[ConfigurationStrings.PeerTransportCredentialType] = value; }
  22. }
  23. internal void ApplyConfiguration(PeerTransportSecuritySettings security)
  24. {
  25. if (security == null)
  26. {
  27. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
  28. }
  29. security.CredentialType = this.CredentialType;
  30. }
  31. internal void InitializeFrom(PeerTransportSecuritySettings security)
  32. {
  33. if (security == null)
  34. {
  35. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
  36. }
  37. SetPropertyValueIfNotDefaultValue(ConfigurationStrings.PeerTransportCredentialType, security.CredentialType);
  38. }
  39. internal void CopyFrom(PeerTransportSecurityElement security)
  40. {
  41. if (security == null)
  42. {
  43. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("security");
  44. }
  45. this.CredentialType = security.CredentialType;
  46. }
  47. }
  48. }