Class HashedSharedSecretValidator
- Namespace
- Fdyay.IdentityServer.Validation
- Assembly
- Fdyay.IdentityServer.Core.dll
Checks a shared secret presented in the clear against the SHA-256 hashes stored for it.
public sealed class HashedSharedSecretValidator : ISecretValidator
- Inheritance
-
HashedSharedSecretValidator
- Implements
- Inherited Members
Methods
ValidateAsync(IEnumerable<Secret>, ParsedSecret, CancellationToken)
Checks the presented credential against the stored secrets.
public Task<SecretValidationResult> ValidateAsync(IEnumerable<Secret> secrets, ParsedSecret parsedSecret, CancellationToken cancellationToken = default)
Parameters
secretsIEnumerable<Secret>The stored secrets of the client or API — only unexpired ones, when called by SecretValidator.
parsedSecretParsedSecretThe credential a secret parser read off the request.
cancellationTokenCancellationTokenCancels the check.
Returns
- Task<SecretValidationResult>
Success when the credential matched one of
secrets; failure otherwise, and for a credential type this validator does not handle.
Remarks
Only a parsed shared secret is considered, and only against secrets of type SharedSecret: the presented value's
SHA-256 is compared, in constant time, with each of them.
Exceptions
- ArgumentNullException
secretsorparsedSecretisnull.