/
SamlAssertionKeyIdentifierClause.cs
58 lines (51 loc) · 2.07 KB
/
SamlAssertionKeyIdentifierClause.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Globalization;
namespace System.IdentityModel.Tokens
{
/// <summary>
///
/// </summary>
public class SamlAssertionKeyIdentifierClause : SecurityKeyIdentifierClause
{
/// <summary>
///
/// </summary>
/// <param name="assertionId"></param>
public SamlAssertionKeyIdentifierClause(string assertionId) : base(assertionId, null, 0)
{
}
/// <summary>
///
/// </summary>
/// <param name="assertionId"></param>
/// <param name="keyIdentifierClause"></param>
/// <returns></returns>
public static bool Matches(string assertionId, SecurityKeyIdentifierClause keyIdentifierClause)
{
if (null == keyIdentifierClause)
return false;
if (keyIdentifierClause is SamlAssertionKeyIdentifierClause samlClause && StringComparer.Ordinal.Equals(assertionId, samlClause.Id))
return true;
return false;
}
/// <summary>
/// Indicates whether the <see cref="SecurityKeyIdentifierClause"/> for this instance is matches the specified <see cref="SecurityKeyIdentifierClause"/>.
/// </summary>
/// <param name="keyIdentifierClause">A <see cref="SecurityKeyIdentifierClause"/> to match.</param>
/// <returns>True if the keyIdentifier matches this. False otherwise.</returns>
public override bool Matches(SecurityKeyIdentifierClause keyIdentifierClause)
{
return ReferenceEquals(this, keyIdentifierClause) || Matches(Id, keyIdentifierClause);
}
/// <summary>
/// -
/// </summary>
/// <returns></returns>
public override string ToString()
{
return string.Format(CultureInfo.InvariantCulture, "SamlAssertionKeyIdentifierClause(AssertionId = '{0}')", Id);
}
}
}