| | | 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.ComponentModel; |
| | | 5 | | |
| | | 6 | | namespace CoreWCF.Security.Tokens |
| | | 7 | | { |
| | | 8 | | public enum X509KeyIdentifierClauseType |
| | | 9 | | { |
| | | 10 | | Any = 0, |
| | | 11 | | Thumbprint = 1, |
| | | 12 | | IssuerSerial = 2, |
| | | 13 | | SubjectKeyIdentifier = 3, |
| | | 14 | | RawDataKeyIdentifier = 4 |
| | | 15 | | } |
| | | 16 | | |
| | | 17 | | internal static class X509SecurityTokenReferenceStyleHelper |
| | | 18 | | { |
| | | 19 | | public static bool IsDefined(X509KeyIdentifierClauseType value) |
| | | 20 | | { |
| | 33 | 21 | | return (value == X509KeyIdentifierClauseType.Any |
| | 33 | 22 | | || value == X509KeyIdentifierClauseType.IssuerSerial |
| | 33 | 23 | | || value == X509KeyIdentifierClauseType.SubjectKeyIdentifier |
| | 33 | 24 | | || value == X509KeyIdentifierClauseType.Thumbprint |
| | 33 | 25 | | || value == X509KeyIdentifierClauseType.RawDataKeyIdentifier); |
| | | 26 | | } |
| | | 27 | | |
| | | 28 | | public static void Validate(X509KeyIdentifierClauseType value) |
| | | 29 | | { |
| | 33 | 30 | | if (!IsDefined(value)) |
| | | 31 | | { |
| | 0 | 32 | | throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException(nameof(value) |
| | 0 | 33 | | typeof(X509KeyIdentifierClauseType))); |
| | | 34 | | } |
| | 33 | 35 | | } |
| | | 36 | | } |
| | | 37 | | } |