@Singleton public class JWTClaimsSetGenerator extends java.lang.Object implements ClaimsGenerator
Constructor and Description |
---|
JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration,
JwtIdGenerator jwtIdGenerator,
ClaimsAudienceProvider claimsAudienceProvider)
|
JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration,
JwtIdGenerator jwtIdGenerator,
ClaimsAudienceProvider claimsAudienceProvider,
io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) |
Modifier and Type | Method and Description |
---|---|
java.util.Map<java.lang.String,java.lang.Object> |
generateClaims(UserDetails userDetails,
java.lang.Integer expiration) |
java.util.Map<java.lang.String,java.lang.Object> |
generateClaimsSet(java.util.Map<java.lang.String,?> oldClaims,
java.lang.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,
java.lang.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 io.micronaut.runtime.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 configuration@Deprecated public JWTClaimsSetGenerator(TokenConfiguration tokenConfiguration, @Nullable JwtIdGenerator jwtIdGenerator, @Nullable ClaimsAudienceProvider claimsAudienceProvider)
JWTClaimsSetGenerator(TokenConfiguration, JwtIdGenerator, ClaimsAudienceProvider, ApplicationConfiguration)
instead.tokenConfiguration
- Token ConfigurationjwtIdGenerator
- Generator which creates unique JWT IDclaimsAudienceProvider
- Provider which identifies the recipients that the JWT is intented for.public java.util.Map<java.lang.String,java.lang.Object> generateClaims(UserDetails userDetails, @Nullable java.lang.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 java.lang.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 java.util.Map<java.lang.String,java.lang.Object> generateClaimsSet(java.util.Map<java.lang.String,?> oldClaims, java.lang.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