Class DefaultJwtAuthenticationFactory
java.lang.Object
io.micronaut.security.token.AbstractTokenAuthenticationFactory<com.nimbusds.jwt.JWT>
io.micronaut.security.token.jwt.validator.DefaultJwtAuthenticationFactory
- All Implemented Interfaces:
JwtAuthenticationFactory,TokenAuthenticationFactory<com.nimbusds.jwt.JWT>
@Singleton
public class DefaultJwtAuthenticationFactory
extends AbstractTokenAuthenticationFactory<com.nimbusds.jwt.JWT>
implements JwtAuthenticationFactory
Extracts the JWT claims and uses the
AuthenticationJWTClaimsSetAdapter to construction an Authentication object.- Since:
- 1.1.0
- Author:
- Sergio del Amo
-
Constructor Summary
ConstructorsConstructorDescriptionDefaultJwtAuthenticationFactory(TokenConfiguration tokenConfiguration, RolesFinder rolesFinder) -
Method Summary
Modifier and TypeMethodDescriptioncreateAuthentication(com.nimbusds.jwt.JWT token) usernameForClaims(com.nimbusds.jwt.JWTClaimsSet claimSet) Deprecated.Methods inherited from class io.micronaut.security.token.AbstractTokenAuthenticationFactory
createAuthentication, usernameForClaims
-
Constructor Details
-
DefaultJwtAuthenticationFactory
public DefaultJwtAuthenticationFactory(TokenConfiguration tokenConfiguration, RolesFinder rolesFinder) - Parameters:
tokenConfiguration- Token ConfigurationrolesFinder- Utility to retrieve roles from token claims
-
-
Method Details
-
createAuthentication
- Specified by:
createAuthenticationin interfaceJwtAuthenticationFactory- Specified by:
createAuthenticationin interfaceTokenAuthenticationFactory<com.nimbusds.jwt.JWT>- Parameters:
token- The token- Returns:
- An Authentication object.
-
usernameForClaims
@Deprecated protected Optional<String> usernameForClaims(com.nimbusds.jwt.JWTClaimsSet claimSet) throws ParseException Deprecated.- Parameters:
claimSet- JWT Claims- Returns:
- the username defined by
TokenConfiguration.getNameKey()()} or the sub claim. - Throws:
ParseException- might be thrown parsing claims
-
AbstractTokenAuthenticationFactory.usernameForClaims(io.micronaut.security.token.Claims)instead.