@Singleton public class JwtTokenGenerator extends java.lang.Object implements TokenGenerator
Modifier and Type | Field and Description |
---|---|
protected ClaimsGenerator |
claimsGenerator |
protected EncryptionConfiguration |
encryptionConfiguration |
protected SignatureGeneratorConfiguration |
signatureConfiguration |
Constructor and Description |
---|
JwtTokenGenerator(SignatureGeneratorConfiguration signatureConfiguration,
EncryptionConfiguration encryptionConfiguration,
ClaimsGenerator claimsGenerator) |
Modifier and Type | Method and Description |
---|---|
protected java.lang.String |
generate(java.util.Map<java.lang.String,java.lang.Object> claims)
Generate a JWT from a map of claims.
|
java.util.Optional<java.lang.String> |
generateToken(java.util.Map<java.lang.String,java.lang.Object> claims) |
java.util.Optional<java.lang.String> |
generateToken(UserDetails userDetails,
java.lang.Integer expiration) |
EncryptionConfiguration |
getEncryptionConfiguration()
encryptionConfiguration getter.
|
SignatureGeneratorConfiguration |
getSignatureConfiguration()
signatureConfiguration getter.
|
protected java.lang.String |
internalGenerate(com.nimbusds.jwt.JWTClaimsSet claimsSet)
Generate a JWT from a claims set.
|
protected final ClaimsGenerator claimsGenerator
protected final SignatureGeneratorConfiguration signatureConfiguration
protected final EncryptionConfiguration encryptionConfiguration
public JwtTokenGenerator(@Nullable @Named(value="generator") SignatureGeneratorConfiguration signatureConfiguration, @Nullable @Named(value="generator") EncryptionConfiguration encryptionConfiguration, ClaimsGenerator claimsGenerator)
signatureConfiguration
- JWT Generator signature configurationencryptionConfiguration
- JWT Generator encryption configurationclaimsGenerator
- Claims generatorpublic SignatureGeneratorConfiguration getSignatureConfiguration()
SignatureGeneratorConfiguration
public EncryptionConfiguration getEncryptionConfiguration()
EncryptionConfiguration
protected java.lang.String internalGenerate(com.nimbusds.jwt.JWTClaimsSet claimsSet) throws com.nimbusds.jose.JOSEException, java.text.ParseException
claimsSet
- the claims setcom.nimbusds.jose.JOSEException
- thrown in the JWT generationjava.text.ParseException
- thrown in the JWT generationprotected java.lang.String generate(java.util.Map<java.lang.String,java.lang.Object> claims) throws com.nimbusds.jose.JOSEException, java.text.ParseException
claims
- the map of claimscom.nimbusds.jose.JOSEException
- thrown in the JWT generationjava.text.ParseException
- thrown in the JWT generationpublic java.util.Optional<java.lang.String> generateToken(UserDetails userDetails, @Nullable java.lang.Integer expiration)
generateToken
in interface TokenGenerator
userDetails
- Authenticated user's representation.expiration
- The amount of time in milliseconds until the token expirespublic java.util.Optional<java.lang.String> generateToken(java.util.Map<java.lang.String,java.lang.Object> claims)
generateToken
in interface TokenGenerator
claims
- JWT claims