HttpDigestClientElement.cs 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. //------------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //------------------------------------------------------------------------------
  4. namespace System.ServiceModel.Configuration
  5. {
  6. using System;
  7. using System.ServiceModel;
  8. using System.Configuration;
  9. using System.ServiceModel.Security;
  10. using System.ServiceModel.Channels;
  11. using System.Xml;
  12. using System.Security.Principal;
  13. using System.Security.Cryptography.X509Certificates;
  14. public sealed partial class HttpDigestClientElement : ConfigurationElement
  15. {
  16. public HttpDigestClientElement()
  17. {
  18. }
  19. [ConfigurationProperty(ConfigurationStrings.ImpersonationLevel, DefaultValue = WindowsClientCredential.DefaultImpersonationLevel)]
  20. [ServiceModelEnumValidator(typeof(TokenImpersonationLevelHelper))]
  21. public TokenImpersonationLevel ImpersonationLevel
  22. {
  23. get { return (TokenImpersonationLevel)base[ConfigurationStrings.ImpersonationLevel]; }
  24. set { base[ConfigurationStrings.ImpersonationLevel] = value; }
  25. }
  26. public void Copy(HttpDigestClientElement from)
  27. {
  28. if (this.IsReadOnly())
  29. {
  30. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigReadOnly)));
  31. }
  32. if (null == from)
  33. {
  34. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("from");
  35. }
  36. this.ImpersonationLevel = from.ImpersonationLevel;
  37. }
  38. internal void ApplyConfiguration(HttpDigestClientCredential digest)
  39. {
  40. if (digest == null)
  41. {
  42. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("digest");
  43. }
  44. digest.AllowedImpersonationLevel = this.ImpersonationLevel;
  45. }
  46. }
  47. }