@Singleton public class JwtTokenGenerator extends 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 String | 
generate(Map<String,Object> claims)
Generate a JWT from a map of claims. 
 | 
Optional<String> | 
generateToken(Map<String,Object> claims)  | 
Optional<String> | 
generateToken(UserDetails userDetails,
             Integer expiration)  | 
EncryptionConfiguration | 
getEncryptionConfiguration()
encryptionConfiguration getter. 
 | 
SignatureGeneratorConfiguration | 
getSignatureConfiguration()
signatureConfiguration getter. 
 | 
protected 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()
SignatureGeneratorConfigurationpublic EncryptionConfiguration getEncryptionConfiguration()
EncryptionConfigurationprotected String internalGenerate(com.nimbusds.jwt.JWTClaimsSet claimsSet) throws com.nimbusds.jose.JOSEException, ParseException
claimsSet - the claims setcom.nimbusds.jose.JOSEException - thrown in the JWT generationParseException - thrown in the JWT generationprotected String generate(Map<String,Object> claims) throws com.nimbusds.jose.JOSEException, ParseException
claims - the map of claimscom.nimbusds.jose.JOSEException - thrown in the JWT generationParseException - thrown in the JWT generationpublic Optional<String> generateToken(UserDetails userDetails, @Nullable Integer expiration)
generateToken in interface TokenGeneratoruserDetails - Authenticated user's representation.expiration - The amount of time in milliseconds until the token expirespublic Optional<String> generateToken(Map<String,Object> claims)
generateToken in interface TokenGeneratorclaims - JWT claims