diff --git a/src/Microsoft.IdentityModel.Tokens/Delegates.cs b/src/Microsoft.IdentityModel.Tokens/Delegates.cs
new file mode 100644
index 0000000000..e2eaebb16a
--- /dev/null
+++ b/src/Microsoft.IdentityModel.Tokens/Delegates.cs
@@ -0,0 +1,179 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+using System;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+namespace Microsoft.IdentityModel.Tokens
+{
+ ///
+ /// Definition for AlgorithmValidator
+ ///
+ /// The algorithm to validate.
+ /// The that signed the .
+ /// The being validated.
+ /// required for validation.
+ /// true if the algorithm is considered valid
+ public delegate bool AlgorithmValidator(string algorithm, SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for AudienceValidator.
+ ///
+ /// The audiences found in the .
+ /// The being validated.
+ /// required for validation.
+ /// true if the audience is considered valid.
+ public delegate bool AudienceValidator(IEnumerable audiences, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for IssuerSigningKeyResolver.
+ ///
+ /// The representation of the token that is being validated.
+ /// The that is being validated. It may be null.
+ /// A key identifier. It may be null.
+ /// required for validation.
+ /// A to use when validating a signature.
+ /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
+ /// priority.
+ public delegate IEnumerable IssuerSigningKeyResolver(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for IssuerSigningKeyResolverUsingConfiguration.
+ ///
+ /// The representation of the token that is being validated.
+ /// The that is being validated. It may be null.
+ /// A key identifier. It may be null.
+ /// required for validation.
+ /// required for validation.
+ /// A to use when validating a signature.
+ /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
+ /// priority.
+ public delegate IEnumerable IssuerSigningKeyResolverUsingConfiguration(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters, BaseConfiguration configuration);
+
+ ///
+ /// Definition for IssuerSigningKeyValidator.
+ ///
+ /// The that signed the .
+ /// The being validated.
+ /// required for validation.
+ /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
+ /// priority.
+ public delegate bool IssuerSigningKeyValidator(SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for IssuerSigningKeyValidatorUsingConfiguration.
+ ///
+ /// The that signed the .
+ /// The being validated.
+ /// required for validation.
+ /// required for validation.
+ /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
+ /// priority.
+ public delegate bool IssuerSigningKeyValidatorUsingConfiguration(SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration);
+
+ ///
+ /// Definition for IssuerValidator.
+ ///
+ /// The issuer to validate.
+ /// The that is being validated.
+ /// required for validation.
+ /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
+ /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
+ /// If both and are set, IssuerValidatorUsingConfiguration takes
+ /// priority.
+ public delegate string IssuerValidator(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for IssuerValidatorUsingConfiguration.
+ ///
+ /// The issuer to validate.
+ /// The that is being validated.
+ /// required for validation.
+ /// required for validation.
+ /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
+ /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
+ /// If both and are set, IssuerValidatorUsingConfiguration takes
+ /// priority.
+ ///
+ public delegate string IssuerValidatorUsingConfiguration(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration);
+
+ ///
+ /// Definition for IssuerValidatorAsync. Left internal for now while we work out the details of async validation for all delegates.
+ ///
+ /// The issuer to validate.
+ /// The that is being validated.
+ /// required for validation.
+ /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
+ /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
+ /// if set, will be called before or
+ ///
+ internal delegate ValueTask IssuerValidatorAsync(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for LifetimeValidator.
+ ///
+ /// The 'notBefore' time found in the .
+ /// The 'expiration' time found in the .
+ /// The being validated.
+ /// required for validation.
+ public delegate bool LifetimeValidator(DateTime? notBefore, DateTime? expires, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for TokenReplayValidator.
+ ///
+ /// The 'expiration' time found in the .
+ /// The being validated.
+ /// required for validation.
+ ///
+ public delegate bool TokenReplayValidator(DateTime? expirationTime, string securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for SignatureValidator.
+ ///
+ /// A securityToken with a signature.
+ /// required for validation.
+ public delegate SecurityToken SignatureValidator(string token, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for SignatureValidator.
+ ///
+ /// A securityToken with a signature.
+ /// required for validation.
+ /// The that is required for validation.
+ public delegate SecurityToken SignatureValidatorUsingConfiguration(string token, TokenValidationParameters validationParameters, BaseConfiguration configuration);
+
+ ///
+ /// Definition for TokenReader.
+ ///
+ /// A securityToken with a signature.
+ /// required for validation.
+ public delegate SecurityToken TokenReader(string token, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for TokenDecryptionKeyResolver.
+ ///
+ /// The representation of the token to be decrypted.
+ /// The to be decrypted. The runtime by default passes null.
+ /// A key identifier. It may be null.
+ /// required for validation.
+ /// A to use when decrypting the token.
+ public delegate IEnumerable TokenDecryptionKeyResolver(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for TypeValidator.
+ ///
+ /// The token type to validate.
+ /// The that is being validated.
+ /// required for validation.
+ /// The actual token type, that may be the same as or a different value if the token type was resolved from a different location.
+ public delegate string TypeValidator(string type, SecurityToken securityToken, TokenValidationParameters validationParameters);
+
+ ///
+ /// Definition for TransformBeforeSignatureValidation.
+ ///
+ /// The that is being validated.
+ /// required for validation.
+ /// A transformed .
+ public delegate SecurityToken TransformBeforeSignatureValidation(SecurityToken token, TokenValidationParameters validationParameters);
+}
diff --git a/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs b/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
index f110a31e45..bb68764a6d 100644
--- a/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
+++ b/src/Microsoft.IdentityModel.Tokens/TokenValidationParameters.cs
@@ -5,182 +5,11 @@
using System.Collections.Generic;
using System.ComponentModel;
using System.Security.Claims;
-using System.Threading.Tasks;
using Microsoft.IdentityModel.Abstractions;
using Microsoft.IdentityModel.Logging;
namespace Microsoft.IdentityModel.Tokens
{
- ///
- /// Definition for AlgorithmValidator
- ///
- /// The algorithm to validate.
- /// The that signed the .
- /// The being validated.
- /// required for validation.
- /// true if the algorithm is considered valid
- public delegate bool AlgorithmValidator(string algorithm, SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for AudienceValidator.
- ///
- /// The audiences found in the .
- /// The being validated.
- /// required for validation.
- /// true if the audience is considered valid.
- public delegate bool AudienceValidator(IEnumerable audiences, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for IssuerSigningKeyResolver.
- ///
- /// The representation of the token that is being validated.
- /// The that is being validated. It may be null.
- /// A key identifier. It may be null.
- /// required for validation.
- /// A to use when validating a signature.
- /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
- /// priority.
- public delegate IEnumerable IssuerSigningKeyResolver(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for IssuerSigningKeyResolverUsingConfiguration.
- ///
- /// The representation of the token that is being validated.
- /// The that is being validated. It may be null.
- /// A key identifier. It may be null.
- /// required for validation.
- /// required for validation.
- /// A to use when validating a signature.
- /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
- /// priority.
- public delegate IEnumerable IssuerSigningKeyResolverUsingConfiguration(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters, BaseConfiguration configuration);
-
- ///
- /// Definition for IssuerSigningKeyValidator.
- ///
- /// The that signed the .
- /// The being validated.
- /// required for validation.
- /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
- /// priority.
- public delegate bool IssuerSigningKeyValidator(SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for IssuerSigningKeyValidatorUsingConfiguration.
- ///
- /// The that signed the .
- /// The being validated.
- /// required for validation.
- /// required for validation.
- /// If both and are set, IssuerSigningKeyResolverUsingConfiguration takes
- /// priority.
- public delegate bool IssuerSigningKeyValidatorUsingConfiguration(SecurityKey securityKey, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration);
-
- ///
- /// Definition for IssuerValidator.
- ///
- /// The issuer to validate.
- /// The that is being validated.
- /// required for validation.
- /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
- /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
- /// If both and are set, IssuerValidatorUsingConfiguration takes
- /// priority.
- public delegate string IssuerValidator(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for IssuerValidatorUsingConfiguration.
- ///
- /// The issuer to validate.
- /// The that is being validated.
- /// required for validation.
- /// required for validation.
- /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
- /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
- /// If both and are set, IssuerValidatorUsingConfiguration takes
- /// priority.
- ///
- public delegate string IssuerValidatorUsingConfiguration(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters, BaseConfiguration configuration);
-
- ///
- /// Definition for IssuerValidatorAsync. Left internal for now while we work out the details of async validation for all delegates.
- ///
- /// The issuer to validate.
- /// The that is being validated.
- /// required for validation.
- /// The issuer to use when creating the "Claim"(s) in a "ClaimsIdentity".
- /// The delegate should return a non null string that represents the 'issuer'. If null a default value will be used.
- /// if set, will be called before or
- ///
- internal delegate ValueTask IssuerValidatorAsync(string issuer, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for LifetimeValidator.
- ///
- /// The 'notBefore' time found in the .
- /// The 'expiration' time found in the .
- /// The being validated.
- /// required for validation.
- public delegate bool LifetimeValidator(DateTime? notBefore, DateTime? expires, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for TokenReplayValidator.
- ///
- /// The 'expiration' time found in the .
- /// The being validated.
- /// required for validation.
- ///
- public delegate bool TokenReplayValidator(DateTime? expirationTime, string securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for SignatureValidator.
- ///
- /// A securityToken with a signature.
- /// required for validation.
- public delegate SecurityToken SignatureValidator(string token, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for SignatureValidator.
- ///
- /// A securityToken with a signature.
- /// required for validation.
- /// The that is required for validation.
- public delegate SecurityToken SignatureValidatorUsingConfiguration(string token, TokenValidationParameters validationParameters, BaseConfiguration configuration);
-
- ///
- /// Definition for TokenReader.
- ///
- /// A securityToken with a signature.
- /// required for validation.
- public delegate SecurityToken TokenReader(string token, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for TokenDecryptionKeyResolver.
- ///
- /// The representation of the token to be decrypted.
- /// The to be decrypted. The runtime by default passes null.
- /// A key identifier. It may be null.
- /// required for validation.
- /// A to use when decrypting the token.
- public delegate IEnumerable TokenDecryptionKeyResolver(string token, SecurityToken securityToken, string kid, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for TypeValidator.
- ///
- /// The token type to validate.
- /// The that is being validated.
- /// required for validation.
- /// The actual token type, that may be the same as or a different value if the token type was resolved from a different location.
- public delegate string TypeValidator(string type, SecurityToken securityToken, TokenValidationParameters validationParameters);
-
- ///
- /// Definition for TransformBeforeSignatureValidation.
- ///
- /// The that is being validated.
- /// required for validation.
- /// A transformed .
- public delegate SecurityToken TransformBeforeSignatureValidation(SecurityToken token, TokenValidationParameters validationParameters);
-
///
/// Contains a set of parameters that are used by a when validating a .
///