| | | 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; |
| | | 5 | | using System.Collections.Generic; |
| | | 6 | | using System.Globalization; |
| | | 7 | | using System.Xml; |
| | | 8 | | using CoreWCF.Channels; |
| | | 9 | | |
| | | 10 | | namespace CoreWCF.Security |
| | | 11 | | { |
| | | 12 | | internal sealed class RequestSecurityTokenResponseCollection : BodyWriter |
| | | 13 | | { |
| | | 14 | | private readonly SecurityStandardsManager _standardsManager; |
| | | 15 | | |
| | | 16 | | public RequestSecurityTokenResponseCollection(IEnumerable<RequestSecurityTokenResponse> rstrCollection) |
| | 0 | 17 | | : this(rstrCollection, SecurityStandardsManager.DefaultInstance) |
| | 0 | 18 | | { } |
| | | 19 | | |
| | | 20 | | public RequestSecurityTokenResponseCollection(IEnumerable<RequestSecurityTokenResponse> rstrCollection, Security |
| | 8 | 21 | | : base(true) |
| | | 22 | | { |
| | 8 | 23 | | if (rstrCollection == null) |
| | | 24 | | { |
| | 0 | 25 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(rstrCollection)); |
| | | 26 | | } |
| | | 27 | | |
| | 8 | 28 | | int index = 0; |
| | 32 | 29 | | foreach (RequestSecurityTokenResponse rstr in rstrCollection) |
| | | 30 | | { |
| | 8 | 31 | | if (rstr == null) |
| | | 32 | | { |
| | 0 | 33 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(string.Format(CultureInfo.Invariant |
| | | 34 | | } |
| | | 35 | | |
| | 8 | 36 | | ++index; |
| | | 37 | | } |
| | 8 | 38 | | RstrCollection = rstrCollection; |
| | 8 | 39 | | _standardsManager = standardsManager ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new Argume |
| | 8 | 40 | | } |
| | | 41 | | |
| | 8 | 42 | | public IEnumerable<RequestSecurityTokenResponse> RstrCollection { get; } |
| | | 43 | | |
| | | 44 | | public void WriteTo(XmlWriter writer) |
| | | 45 | | { |
| | 8 | 46 | | _standardsManager.TrustDriver.WriteRequestSecurityTokenResponseCollection(this, writer); |
| | 8 | 47 | | } |
| | | 48 | | |
| | | 49 | | protected override void OnWriteBodyContents(XmlDictionaryWriter writer) |
| | | 50 | | { |
| | 8 | 51 | | WriteTo(writer); |
| | 8 | 52 | | } |
| | | 53 | | } |
| | | 54 | | } |