| | | 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 | | |
| | | 6 | | namespace CoreWCF.IdentityModel.Tokens.Saml |
| | | 7 | | { |
| | | 8 | | /// <summary> |
| | | 9 | | /// Represents the KeyIdentifier of X509Data as per: TODO - need url to STRTransform |
| | | 10 | | /// </summary> |
| | | 11 | | public class SecurityKeyIdentifier |
| | | 12 | | { |
| | | 13 | | /// <summary> |
| | | 14 | | /// Creates an SecurityKeyIdentifier using the specified KeyIdentifierType and EncodingType. |
| | | 15 | | /// </summary> |
| | 3 | 16 | | public SecurityKeyIdentifier(string valueType, string encodingType, string value) |
| | | 17 | | { |
| | 3 | 18 | | ValueType = valueType; |
| | 3 | 19 | | EncodingType = encodingType; |
| | 3 | 20 | | Value = value; |
| | 3 | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Gets the ValueType of the SecurityKeyIdentifier |
| | | 25 | | /// </summary> |
| | 7 | 26 | | public string ValueType { get; } |
| | | 27 | | |
| | | 28 | | /// <summary> |
| | | 29 | | /// Gets the EncodingType of the SecurityKeyIdentifier. |
| | | 30 | | /// </summary> |
| | 7 | 31 | | public string EncodingType { get; } |
| | | 32 | | |
| | | 33 | | /// <summary> |
| | | 34 | | /// Gets the value of the SecurityKeyIdentifier. |
| | | 35 | | /// </summary> |
| | 10 | 36 | | public string Value { get; set; } |
| | | 37 | | |
| | | 38 | | /// <summary> |
| | | 39 | | /// Determines whether the specified object is equal to the current object. |
| | | 40 | | /// </summary> |
| | | 41 | | /// <param name="obj">The object to compare with the current object.</param> |
| | | 42 | | /// <returns>true if the specified object is equal to the current object; otherwise, false.</returns> |
| | | 43 | | public override bool Equals(object obj) |
| | | 44 | | { |
| | 0 | 45 | | if (obj is not SecurityKeyIdentifier other) |
| | 0 | 46 | | return false; |
| | | 47 | | |
| | 0 | 48 | | if (other is null) |
| | 0 | 49 | | return false; |
| | | 50 | | |
| | 0 | 51 | | if (ReferenceEquals(this, other)) |
| | 0 | 52 | | return true; |
| | | 53 | | |
| | 0 | 54 | | return string.Equals(ValueType, other.ValueType) && |
| | 0 | 55 | | string.Equals(EncodingType, other.EncodingType) && |
| | 0 | 56 | | string.Equals(Value, other.Value); |
| | | 57 | | } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Serves as the default hash function. |
| | | 61 | | /// </summary> |
| | | 62 | | /// <returns>A hash code for the current object.</returns> |
| | | 63 | | public override int GetHashCode() |
| | | 64 | | { |
| | 0 | 65 | | return HashCode.Combine(ValueType, EncodingType, Value); |
| | | 66 | | } |
| | | 67 | | } |
| | | 68 | | } |