Class DefaultJwtAuthenticationFactory
java.lang.Object
io.micronaut.security.token.jwt.validator.DefaultJwtAuthenticationFactory
- All Implemented Interfaces:
JwtAuthenticationFactory,TokenAuthenticationFactory<com.nimbusds.jwt.JWT>
@Singleton
public class DefaultJwtAuthenticationFactory
extends Object
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)
-
Constructor Details
-
DefaultJwtAuthenticationFactory
public DefaultJwtAuthenticationFactory(TokenConfiguration tokenConfiguration, RolesFinder rolesFinder)
-
-
Method Details
-
createAuthentication
- Specified by:
createAuthenticationin interfaceJwtAuthenticationFactory- Specified by:
createAuthenticationin interfaceTokenAuthenticationFactory<com.nimbusds.jwt.JWT>- Parameters:
token- The token- Returns:
- An Authentication object.
-
usernameForClaims
protected Optional<String> usernameForClaims(com.nimbusds.jwt.JWTClaimsSet claimSet) throws ParseException - Parameters:
claimSet- JWT Claims- Returns:
- the username defined by
TokenConfiguration.getNameKey()()} or the sub claim. - Throws:
ParseException- might be thrown parsing claims
-