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>

@Singleton public class JwtTokenValidator<T> extends Object implements TokenValidator<T>
Since:
1.0
Author:
Sergio del Amo
See Also:
  • Field Details

  • Constructor Details

    • JwtTokenValidator

      @Inject public JwtTokenValidator(Collection<SignatureConfiguration> signatureConfigurations, Collection<EncryptionConfiguration> encryptionConfigurations, Collection<GenericJwtClaimsValidator> genericJwtClaimsValidators, JwtAuthenticationFactory jwtAuthenticationFactory)
      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

      public JwtTokenValidator(JwtValidator<T> validator, JwtAuthenticationFactory jwtAuthenticationFactory)
      Parameters:
      validator - Validates the JWT
      jwtAuthenticationFactory - The authentication factory
  • 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 interface TokenValidator<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.