@Singleton public class JwtTokenValidator extends java.lang.Object implements TokenValidator
| Modifier and Type | Field and Description |
|---|---|
protected JwtAuthenticationFactory |
jwtAuthenticationFactory |
protected JwtValidator |
validator |
| Constructor and Description |
|---|
JwtTokenValidator(java.util.Collection<SignatureConfiguration> signatureConfigurations,
java.util.Collection<EncryptionConfiguration> encryptionConfigurations,
java.util.Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators,
JwtAuthenticationFactory jwtAuthenticationFactory)
Constructor.
|
JwtTokenValidator(JwtValidator validator,
JwtAuthenticationFactory jwtAuthenticationFactory) |
| Modifier and Type | Method and Description |
|---|---|
org.reactivestreams.Publisher<Authentication> |
validateToken(java.lang.String token,
io.micronaut.http.HttpRequest<?> request)
Validates the provided token and returns the authentication state.
|
protected final JwtAuthenticationFactory jwtAuthenticationFactory
protected final JwtValidator validator
@Inject public JwtTokenValidator(java.util.Collection<SignatureConfiguration> signatureConfigurations, java.util.Collection<EncryptionConfiguration> encryptionConfigurations, java.util.Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory)
signatureConfigurations - List of Signature configurations which are used to attempt validation.encryptionConfigurations - List of Encryption configurations which are used to attempt validation.genericJwtClaimsValidators - Generic JWT Claims validators which should be used to validate any JWT.jwtAuthenticationFactory - Utility to generate an Authentication given a JWT.public JwtTokenValidator(JwtValidator validator, JwtAuthenticationFactory jwtAuthenticationFactory)
validator - Validates the JWTjwtAuthenticationFactory - The authentication factorypublic org.reactivestreams.Publisher<Authentication> validateToken(java.lang.String token, @Nullable io.micronaut.http.HttpRequest<?> request)
TokenValidatorvalidateToken in interface TokenValidatortoken - The token string.request - The current request (or null)Authentication based on the JWT or empty if the validation fails.