@Singleton public class JWTClaimsSetGenerator extends Object implements ClaimsGenerator
Constructor and Description |
---|
JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration,
JwtIdGenerator jwtIdGenerator,
ClaimsAudienceProvider claimsAudienceProvider) |
JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration,
JwtIdGenerator jwtIdGenerator,
ClaimsAudienceProvider claimsAudienceProvider,
ApplicationConfiguration applicationConfiguration) |
Modifier and Type | Method and Description |
---|---|
Map<String,Object> |
generateClaims(UserDetails userDetails,
Integer expiration) |
Map<String,Object> |
generateClaimsSet(Map<String,?> oldClaims,
Integer expiration)
Generate a claims set based on claims.
|
protected void |
populateAud(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
Populates aud claim.
|
protected void |
populateExp(com.nimbusds.jwt.JWTClaimsSet.Builder builder,
Integer expiration)
Populates exp claim.
|
protected void |
populateIat(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
Populates iat claim.
|
protected void |
populateIss(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
Populates iss claim.
|
protected void |
populateJti(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
Populates jti claim.
|
protected void |
populateNbf(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
Populates nbf claim.
|
protected void |
populateSub(com.nimbusds.jwt.JWTClaimsSet.Builder builder,
UserDetails userDetails)
Populates sub claim.
|
protected void |
populateWithUserDetails(com.nimbusds.jwt.JWTClaimsSet.Builder builder,
UserDetails userDetails)
Populates Claims with UserDetails object.
|
@Inject public JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration, @Nullable JwtIdGenerator jwtIdGenerator, @Nullable ClaimsAudienceProvider claimsAudienceProvider, @Nullable ApplicationConfiguration applicationConfiguration)
tokenConfiguration
- Token ConfigurationjwtIdGenerator
- Generator which creates unique JWT IDclaimsAudienceProvider
- Provider which identifies the recipients that the JWT is intended for.applicationConfiguration
- The application configurationpublic JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration, @Nullable JwtIdGenerator jwtIdGenerator, @Nullable ClaimsAudienceProvider claimsAudienceProvider)
tokenConfiguration
- Token ConfigurationjwtIdGenerator
- Generator which creates unique JWT IDclaimsAudienceProvider
- Provider which identifies the recipients that the JWT is intented for.public Map<String,Object> generateClaims(UserDetails userDetails, @Nullable Integer expiration)
generateClaims
in interface ClaimsGenerator
userDetails
- Authenticated user's representation.expiration
- expiration time in secondsprotected void populateIss(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
builder
- The Claims Builderprotected void populateSub(com.nimbusds.jwt.JWTClaimsSet.Builder builder, UserDetails userDetails)
builder
- The Claims BuilderuserDetails
- Authenticated user's representation.protected void populateAud(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
builder
- The Claims Builderprotected void populateExp(com.nimbusds.jwt.JWTClaimsSet.Builder builder, @Nullable Integer expiration)
builder
- The Claims Builderexpiration
- expiration time in secondsprotected void populateNbf(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
builder
- The Claims Builderprotected void populateIat(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
builder
- The Claims Builderprotected void populateJti(com.nimbusds.jwt.JWTClaimsSet.Builder builder)
builder
- The Claims Builderprotected void populateWithUserDetails(com.nimbusds.jwt.JWTClaimsSet.Builder builder, UserDetails userDetails)
builder
- the Claims BuilderuserDetails
- Authenticated user's representation.public Map<String,Object> generateClaimsSet(Map<String,?> oldClaims, Integer expiration)
ClaimsGenerator
generateClaimsSet
in interface ClaimsGenerator
oldClaims
- The old claims to use as a base in the new token generation.expiration
- expiration time in secondsJWTClaimsSet