| | | 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.Globalization; |
| | | 5 | | using CoreWCF.IdentityModel; |
| | | 6 | | using UniqueId = System.Xml.UniqueId; |
| | | 7 | | |
| | | 8 | | namespace CoreWCF.Security |
| | | 9 | | { |
| | | 10 | | public class SecurityContextKeyIdentifierClause : SecurityKeyIdentifierClause |
| | | 11 | | { |
| | | 12 | | public SecurityContextKeyIdentifierClause(UniqueId contextId) |
| | 0 | 13 | | : this(contextId, null) |
| | | 14 | | { |
| | 0 | 15 | | } |
| | | 16 | | |
| | | 17 | | public SecurityContextKeyIdentifierClause(UniqueId contextId, UniqueId generation) |
| | 20 | 18 | | : this(contextId, generation, null, 0) |
| | | 19 | | { |
| | 20 | 20 | | } |
| | | 21 | | |
| | | 22 | | public SecurityContextKeyIdentifierClause(UniqueId contextId, UniqueId generation, byte[] derivationNonce, int d |
| | 30 | 23 | | : base(null, derivationNonce, derivationLength) |
| | | 24 | | { |
| | 30 | 25 | | ContextId = contextId ?? throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull(nameof(contextId)) |
| | 30 | 26 | | Generation = generation; |
| | 30 | 27 | | } |
| | | 28 | | |
| | 20 | 29 | | public UniqueId ContextId { get; } |
| | | 30 | | |
| | 20 | 31 | | public UniqueId Generation { get; } |
| | | 32 | | |
| | | 33 | | public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause) |
| | | 34 | | { |
| | 0 | 35 | | SecurityContextKeyIdentifierClause that = keyIdentifierClause as SecurityContextKeyIdentifierClause; |
| | 0 | 36 | | return ReferenceEquals(this, that) || (that != null && that.Matches(ContextId, Generation)); |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | public bool Matches(UniqueId contextId, UniqueId generation) |
| | | 40 | | { |
| | 10 | 41 | | return contextId == ContextId && generation == Generation; |
| | | 42 | | } |
| | | 43 | | |
| | | 44 | | public override string ToString() |
| | | 45 | | { |
| | 0 | 46 | | return string.Format(CultureInfo.InvariantCulture, "SecurityContextKeyIdentifierClause(ContextId = '{0}', Ge |
| | 0 | 47 | | ContextId, Generation); |
| | | 48 | | } |
| | | 49 | | } |
| | | 50 | | } |