Class JwtTokenValidator<T>
java.lang.Object
io.micronaut.security.token.jwt.validator.JwtTokenValidator<T>
- Type Parameters:
T
- Request
- All Implemented Interfaces:
io.micronaut.core.order.Ordered
,TokenValidator<T>
- Since:
- 1.0
- Author:
- Sergio del Amo
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected final JwtAuthenticationFactory
protected final JwtValidator<T>
Fields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
-
Constructor Summary
ConstructorDescriptionJwtTokenValidator
(JwtValidator<T> validator, JwtAuthenticationFactory jwtAuthenticationFactory) Deprecated.JwtTokenValidator
(JwtValidator<T> validator, JwtAuthenticationFactory jwtAuthenticationFactory, reactor.core.scheduler.Scheduler scheduler) JwtTokenValidator
(Collection<SignatureConfiguration> signatureConfigurations, Collection<EncryptionConfiguration> encryptionConfigurations, Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory) Deprecated.JwtTokenValidator
(Collection<SignatureConfiguration> signatureConfigurations, Collection<EncryptionConfiguration> encryptionConfigurations, Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory, ExecutorService executorService) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<Authentication>
validateToken
(String token, T request) Validates the provided token and returns the authentication state.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface io.micronaut.core.order.Ordered
getOrder
-
Field Details
-
jwtAuthenticationFactory
-
validator
-
-
Constructor Details
-
JwtTokenValidator
@Inject public JwtTokenValidator(Collection<SignatureConfiguration> signatureConfigurations, Collection<EncryptionConfiguration> encryptionConfigurations, Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory, @Named("blocking") ExecutorService executorService) Constructor.- Parameters:
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.executorService
- Executor Service
-
JwtTokenValidator
@Deprecated public JwtTokenValidator(Collection<SignatureConfiguration> signatureConfigurations, Collection<EncryptionConfiguration> encryptionConfigurations, Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory) Deprecated.Constructor.- Parameters:
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.
-
JwtTokenValidator
@Deprecated public JwtTokenValidator(JwtValidator<T> validator, JwtAuthenticationFactory jwtAuthenticationFactory) Deprecated.- Parameters:
validator
- Validates the JWTjwtAuthenticationFactory
- The authentication factory
-
JwtTokenValidator
public JwtTokenValidator(JwtValidator<T> validator, JwtAuthenticationFactory jwtAuthenticationFactory, reactor.core.scheduler.Scheduler scheduler) - Parameters:
validator
- Validates the JWTjwtAuthenticationFactory
- The authentication factoryscheduler
- The scheduler to use
-
-
Method Details
-
validateToken
public org.reactivestreams.Publisher<Authentication> validateToken(String token, @Nullable T request) Description copied from interface:TokenValidator
Validates the provided token and returns the authentication state.- Specified by:
validateToken
in interfaceTokenValidator<T>
- Parameters:
token
- The token string.request
- The current request (or null)- Returns:
- Publishes
Authentication
based on the JWT or empty if the validation fails.
-
JwtTokenValidator(JwtValidator, JwtAuthenticationFactory, Scheduler)
instead.