@Singleton public class DefaultAccessRefreshTokenGenerator extends java.lang.Object implements AccessRefreshTokenGenerator
Modifier and Type | Field and Description |
---|---|
protected AccessTokenConfiguration |
accessTokenConfiguration |
protected io.micronaut.context.BeanContext |
beanContext |
protected ClaimsGenerator |
claimsGenerator |
protected io.micronaut.context.event.ApplicationEventPublisher |
eventPublisher |
protected RefreshTokenGenerator |
refreshTokenGenerator |
protected TokenGenerator |
tokenGenerator |
protected TokenRenderer |
tokenRenderer |
Constructor and Description |
---|
DefaultAccessRefreshTokenGenerator(AccessTokenConfiguration accessTokenConfiguration,
TokenRenderer tokenRenderer,
TokenGenerator tokenGenerator,
io.micronaut.context.BeanContext beanContext,
RefreshTokenGenerator refreshTokenGenerator,
ClaimsGenerator claimsGenerator,
io.micronaut.context.event.ApplicationEventPublisher eventPublisher) |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
accessTokenExpiration(Authentication authentication) |
java.lang.Integer |
accessTokenExpiration(java.util.Map<java.lang.String,?> oldClaims) |
java.util.Optional<AccessRefreshToken> |
generate(Authentication authentication)
Generate an
AccessRefreshToken response for the given
user details. |
java.util.Optional<AccessRefreshToken> |
generate(java.lang.String refreshToken,
Authentication authentication)
Generate a new access refresh token.
|
java.util.Optional<AccessRefreshToken> |
generate(java.lang.String refreshToken,
java.util.Map<java.lang.String,?> oldClaims)
Generate an
AccessRefreshToken response for the given
refresh token and claims. |
java.util.Optional<java.lang.String> |
generateRefreshToken(Authentication authentication)
Generates a refresh token and emits a
RefreshTokenGeneratedEvent . |
protected final io.micronaut.context.BeanContext beanContext
protected final RefreshTokenGenerator refreshTokenGenerator
protected final ClaimsGenerator claimsGenerator
protected final AccessTokenConfiguration accessTokenConfiguration
protected final TokenRenderer tokenRenderer
protected final TokenGenerator tokenGenerator
protected final io.micronaut.context.event.ApplicationEventPublisher eventPublisher
public DefaultAccessRefreshTokenGenerator(AccessTokenConfiguration accessTokenConfiguration, TokenRenderer tokenRenderer, TokenGenerator tokenGenerator, io.micronaut.context.BeanContext beanContext, @Nullable RefreshTokenGenerator refreshTokenGenerator, ClaimsGenerator claimsGenerator, io.micronaut.context.event.ApplicationEventPublisher eventPublisher)
accessTokenConfiguration
- The access token generator configtokenRenderer
- The token renderertokenGenerator
- The token generatorbeanContext
- Bean ContextrefreshTokenGenerator
- The refresh token generatorclaimsGenerator
- Claims generatoreventPublisher
- The Application event publisher@NonNull public java.util.Optional<AccessRefreshToken> generate(@NonNull Authentication authentication)
AccessRefreshToken
response for the given
user details.generate
in interface AccessRefreshTokenGenerator
authentication
- Authenticated user's representation.@NonNull public java.util.Optional<java.lang.String> generateRefreshToken(@NonNull Authentication authentication)
RefreshTokenGeneratedEvent
.generateRefreshToken
in interface AccessRefreshTokenGenerator
authentication
- Authenticated user's representation.@NonNull public java.util.Optional<AccessRefreshToken> generate(@Nullable java.lang.String refreshToken, @NonNull java.util.Map<java.lang.String,?> oldClaims)
AccessRefreshToken
response for the given
refresh token and claims.generate
in interface AccessRefreshTokenGenerator
refreshToken
- The refresh tokenoldClaims
- The claims to generate the access token@NonNull public java.util.Optional<AccessRefreshToken> generate(@Nullable java.lang.String refreshToken, @NonNull Authentication authentication)
generate
in interface AccessRefreshTokenGenerator
refreshToken
- The refresh tokenauthentication
- The user details to create a new access token@NonNull public java.lang.Integer accessTokenExpiration(@NonNull Authentication authentication)
authentication
- User details for which the access token is being generated@NonNull public java.lang.Integer accessTokenExpiration(@NonNull java.util.Map<java.lang.String,?> oldClaims)
oldClaims
- The old claims used to build the new token