Interface IJwtValidator
- Namespace
- JWT
- Assembly
- Coherence.JWT.dll
Represents a JWT validator.
public interface IJwtValidator
Methods
TryValidate(string, IAsymmetricAlgorithm, byte[], byte[], out Exception)
Given the JWT, verifies its signatures correctness without throwing an exception but returning it instead.
bool TryValidate(string payloadJson, IAsymmetricAlgorithm alg, byte[] bytesToSign, byte[] decodedSignature, out Exception ex)
Parameters
payloadJson
stringAn arbitrary payload (already serialized to JSON)
alg
IAsymmetricAlgorithmThe asymmetric algorithm to validate with
bytesToSign
byte[]The header and payload bytes to validate
decodedSignature
byte[]The decodedSignatures to validate with
ex
ExceptionValidation exception, if any
Returns
- bool
True if exception is JWT is valid and exception is null, otherwise false
TryValidate(string, string, string, out Exception)
Given the JWT, verifies its signature correctness without throwing an exception but returning it instead.
bool TryValidate(string payloadJson, string signature, string decodedSignature, out Exception ex)
Parameters
payloadJson
stringAn arbitrary payload (already serialized to JSON)
signature
stringDecoded body
decodedSignature
stringThe signature to validate with
ex
ExceptionThe resulting validation exception, if any
Returns
- bool
Returns
true
if exception is JWT is valid and exception is null, otherwise false
TryValidate(string, string, string[], out Exception)
Given the JWT, verifies its signature correctness without throwing an exception but returning it instead.
bool TryValidate(string payloadJson, string signature, string[] decodedSignature, out Exception ex)
Parameters
payloadJson
stringAn arbitrary payload (already serialized to JSON)
signature
stringDecoded body
decodedSignature
string[]The signatures to validate with
ex
ExceptionThe resulting validation exception, if any
Returns
- bool
Returns
true
if exception is JWT is valid and exception is null, otherwise false
Validate(string, IAsymmetricAlgorithm, byte[], byte[])
Given the JWT, verifies its signature correctness.
void Validate(string decodedPayload, IAsymmetricAlgorithm alg, byte[] bytesToSign, byte[] decodedSignature)
Parameters
decodedPayload
stringAn arbitrary payload (already serialized to JSON)
alg
IAsymmetricAlgorithmThe asymmetric algorithm to validate with
bytesToSign
byte[]The header and payload bytes to validate
decodedSignature
byte[]The signature to validate with
Remarks
Used by the asymmetric algorithms only.
Validate(string, string, params string[])
Given the JWT, verifies its signature correctness.
void Validate(string decodedPayload, string signature, params string[] decodedSignatures)