SspiNegotiationTokenProviderState.cs 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Security
  5. {
  6. using System.IdentityModel.Claims;
  7. using System.ServiceModel;
  8. using System.IdentityModel.Policy;
  9. using System.Security.Principal;
  10. using System.Security.Cryptography;
  11. using System.Security.Cryptography.X509Certificates;
  12. using System.Collections.Generic;
  13. using System.ServiceModel.Channels;
  14. using System.Net;
  15. using System.Diagnostics;
  16. class SspiNegotiationTokenProviderState : IssuanceTokenProviderState
  17. {
  18. ISspiNegotiation sspiNegotiation;
  19. HashAlgorithm negotiationDigest;
  20. public SspiNegotiationTokenProviderState(ISspiNegotiation sspiNegotiation)
  21. : base()
  22. {
  23. if (sspiNegotiation == null)
  24. {
  25. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("sspiNegotiation");
  26. }
  27. this.sspiNegotiation = sspiNegotiation;
  28. this.negotiationDigest = CryptoHelper.NewSha1HashAlgorithm();
  29. }
  30. public ISspiNegotiation SspiNegotiation
  31. {
  32. get
  33. {
  34. return this.sspiNegotiation;
  35. }
  36. }
  37. internal HashAlgorithm NegotiationDigest
  38. {
  39. get
  40. {
  41. return this.negotiationDigest;
  42. }
  43. }
  44. public override void Dispose()
  45. {
  46. try
  47. {
  48. if (this.sspiNegotiation != null)
  49. {
  50. this.sspiNegotiation.Dispose();
  51. this.sspiNegotiation = null;
  52. ((IDisposable)this.negotiationDigest).Dispose();
  53. this.negotiationDigest = null;
  54. }
  55. }
  56. finally
  57. {
  58. base.Dispose();
  59. }
  60. }
  61. }
  62. }