@Singleton public class JWTClaimsSetGenerator extends java.lang.Object implements ClaimsGenerator
Constructor and Description |
---|
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(Authentication authentication,
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,
Authentication authentication)
Populates sub claim.
|
protected void |
populateWithAuthentication(com.nimbusds.jwt.JWTClaimsSet.Builder builder,
Authentication authentication)
Populates Claims with Authentication object.
|
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 configurationpublic java.util.Map<java.lang.String,java.lang.Object> generateClaims(Authentication authentication, @Nullable java.lang.Integer expiration)
generateClaims
in interface ClaimsGenerator
authentication
- 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, Authentication authentication)
builder
- The Claims Builderauthentication
- 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 populateWithAuthentication(com.nimbusds.jwt.JWTClaimsSet.Builder builder, Authentication authentication)
builder
- the Claims Builderauthentication
- 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