RequestSecurityTokenResponseCollection.cs 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. //-----------------------------------------------------------------------------
  2. // Copyright (c) Microsoft Corporation. All rights reserved.
  3. //-----------------------------------------------------------------------------
  4. namespace System.ServiceModel.Security
  5. {
  6. using System.ServiceModel;
  7. using System.ServiceModel.Channels;
  8. using System.IdentityModel.Claims;
  9. using System.IdentityModel.Policy;
  10. using System.Xml;
  11. using System.Collections.Generic;
  12. using System.ServiceModel.Security;
  13. using System.Globalization;
  14. sealed class RequestSecurityTokenResponseCollection : BodyWriter
  15. {
  16. IEnumerable<RequestSecurityTokenResponse> rstrCollection;
  17. SecurityStandardsManager standardsManager;
  18. public RequestSecurityTokenResponseCollection(IEnumerable<RequestSecurityTokenResponse> rstrCollection)
  19. : this(rstrCollection, SecurityStandardsManager.DefaultInstance)
  20. { }
  21. public RequestSecurityTokenResponseCollection(IEnumerable<RequestSecurityTokenResponse> rstrCollection, SecurityStandardsManager standardsManager)
  22. : base(true)
  23. {
  24. if (rstrCollection == null)
  25. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("rstrCollection");
  26. int index = 0;
  27. foreach (RequestSecurityTokenResponse rstr in rstrCollection)
  28. {
  29. if (rstr == null)
  30. throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(String.Format(CultureInfo.InvariantCulture, "rstrCollection[{0}]", index));
  31. ++index;
  32. }
  33. this.rstrCollection = rstrCollection;
  34. if (standardsManager == null)
  35. {
  36. throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentNullException("standardsManager"));
  37. }
  38. this.standardsManager = standardsManager;
  39. }
  40. public IEnumerable<RequestSecurityTokenResponse> RstrCollection
  41. {
  42. get
  43. {
  44. return this.rstrCollection;
  45. }
  46. }
  47. public void WriteTo(XmlWriter writer)
  48. {
  49. this.standardsManager.TrustDriver.WriteRequestSecurityTokenResponseCollection(this, writer);
  50. }
  51. protected override void OnWriteBodyContents(XmlDictionaryWriter writer)
  52. {
  53. WriteTo(writer);
  54. }
  55. }
  56. }