Class JwtAuthenticator
java.lang.Object
org.pac4j.core.util.InitializableObject
org.pac4j.core.profile.definition.ProfileDefinitionAware
org.pac4j.jwt.credentials.authenticator.JwtAuthenticator
- All Implemented Interfaces:
org.pac4j.core.credentials.authenticator.Authenticator
public class JwtAuthenticator
extends org.pac4j.core.profile.definition.ProfileDefinitionAware
implements org.pac4j.core.credentials.authenticator.Authenticator
Authenticator for JWT. It creates the user profile and stores it in the credentials
for the
AuthenticatorProfileCreator.- Since:
- 1.8.0
- Author:
- Jerome Leleu
-
Field Summary
FieldsFields inherited from interface org.pac4j.core.credentials.authenticator.Authenticator
ALWAYS_VALIDATE -
Constructor Summary
ConstructorsConstructorDescriptionJwtAuthenticator(List<SignatureConfiguration> signatureConfigurations) JwtAuthenticator(List<SignatureConfiguration> signatureConfigurations, List<EncryptionConfiguration> encryptionConfigurations) JwtAuthenticator(SignatureConfiguration signatureConfiguration) JwtAuthenticator(SignatureConfiguration signatureConfiguration, EncryptionConfiguration encryptionConfiguration) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) voidaddSignatureConfiguration(SignatureConfiguration signatureConfiguration) protected voidcreateJwtProfile(org.pac4j.core.credentials.TokenCredentials credentials, com.nimbusds.jwt.JWT jwt, org.pac4j.core.context.WebContext context, org.pac4j.core.context.session.SessionStore sessionStore) org.pac4j.core.util.generator.ValueGeneratorprotected voidinternalInit(boolean forceReinit) voidsetEncryptionConfiguration(EncryptionConfiguration encryptionConfiguration) voidsetEncryptionConfigurations(List<EncryptionConfiguration> encryptionConfigurations) voidsetExpirationTime(Date expirationTime) voidsetIdentifierGenerator(org.pac4j.core.util.generator.ValueGenerator identifierGenerator) voidsetRealmName(String realmName) voidsetSignatureConfiguration(SignatureConfiguration signatureConfiguration) voidsetSignatureConfigurations(List<SignatureConfiguration> signatureConfigurations) toString()voidvalidate(org.pac4j.core.credentials.Credentials cred, org.pac4j.core.context.WebContext context, org.pac4j.core.context.session.SessionStore sessionStore) org.pac4j.core.profile.UserProfilevalidateToken(String token) Validates the token and returns the corresponding user profile.validateTokenAndGetClaims(String token) Validates the token and returns the corresponding user profile.Methods inherited from class org.pac4j.core.profile.definition.ProfileDefinitionAware
defaultProfileDefinition, getProfileDefinition, setProfileDefinitionMethods inherited from class org.pac4j.core.util.InitializableObject
afterInternalInit, beforeInternalInit, getLastAttempt, getMaxAttempts, getMinTimeIntervalBetweenAttemptsInMilliseconds, getNbAttempts, init, init, isInitialized, reinit, setMaxAttempts, setMinTimeIntervalBetweenAttemptsInMilliseconds, shouldInitialize
-
Field Details
-
logger
protected final org.slf4j.Logger logger
-
-
Constructor Details
-
JwtAuthenticator
public JwtAuthenticator() -
JwtAuthenticator
-
JwtAuthenticator
public JwtAuthenticator(List<SignatureConfiguration> signatureConfigurations, List<EncryptionConfiguration> encryptionConfigurations) -
JwtAuthenticator
-
JwtAuthenticator
public JwtAuthenticator(SignatureConfiguration signatureConfiguration, EncryptionConfiguration encryptionConfiguration)
-
-
Method Details
-
internalInit
protected void internalInit(boolean forceReinit) - Specified by:
internalInitin classorg.pac4j.core.util.InitializableObject
-
validateTokenAndGetClaims
Validates the token and returns the corresponding user profile.- Parameters:
token- the JWT- Returns:
- the corresponding user profile
-
validateToken
Validates the token and returns the corresponding user profile.- Parameters:
token- the JWT- Returns:
- the corresponding user profile
-
validate
public void validate(org.pac4j.core.credentials.Credentials cred, org.pac4j.core.context.WebContext context, org.pac4j.core.context.session.SessionStore sessionStore) - Specified by:
validatein interfaceorg.pac4j.core.credentials.authenticator.Authenticator
-
createJwtProfile
protected void createJwtProfile(org.pac4j.core.credentials.TokenCredentials credentials, com.nimbusds.jwt.JWT jwt, org.pac4j.core.context.WebContext context, org.pac4j.core.context.session.SessionStore sessionStore) throws ParseException - Throws:
ParseException
-
getSignatureConfigurations
-
setSignatureConfiguration
-
addSignatureConfiguration
-
setSignatureConfigurations
-
getEncryptionConfigurations
-
setEncryptionConfiguration
-
addEncryptionConfiguration
-
setEncryptionConfigurations
-
getRealmName
-
setRealmName
-
setExpirationTime
-
getExpirationTime
-
getIdentifierGenerator
public org.pac4j.core.util.generator.ValueGenerator getIdentifierGenerator() -
setIdentifierGenerator
public void setIdentifierGenerator(org.pac4j.core.util.generator.ValueGenerator identifierGenerator) -
toString
-