@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(java.util.Map<java.lang.String,?> oldClaims) |
java.lang.Integer |
accessTokenExpiration(UserDetails userDetails) |
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<AccessRefreshToken> |
generate(java.lang.String refreshToken,
UserDetails userDetails)
Generate a new access refresh token.
|
java.util.Optional<AccessRefreshToken> |
generate(UserDetails userDetails)
Generate an
AccessRefreshToken response for the given
user details. |
java.util.Optional<java.lang.String> |
generateRefreshToken(UserDetails userDetails)
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 UserDetails userDetails)
AccessRefreshToken
response for the given
user details.generate
in interface AccessRefreshTokenGenerator
userDetails
- Authenticated user's representation.@NonNull public java.util.Optional<java.lang.String> generateRefreshToken(@NonNull UserDetails userDetails)
RefreshTokenGeneratedEvent
.generateRefreshToken
in interface AccessRefreshTokenGenerator
userDetails
- Authenticated user's representation.@NonNull public java.util.Optional<AccessRefreshToken> generate(@NonNull 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(@NonNull java.lang.String refreshToken, @NonNull UserDetails userDetails)
generate
in interface AccessRefreshTokenGenerator
refreshToken
- The refresh tokenuserDetails
- The user details to create a new access token@NonNull public java.lang.Integer accessTokenExpiration(@NonNull UserDetails userDetails)
userDetails
- 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