Class SignedRefreshTokenGenerator
java.lang.Object
io.micronaut.security.token.jwt.generator.SignedRefreshTokenGenerator
- All Implemented Interfaces:
RefreshTokenGenerator
,RefreshTokenValidator
@Singleton
@Requires(beans=RefreshTokenConfiguration.class)
public class SignedRefreshTokenGenerator
extends Object
implements RefreshTokenGenerator, RefreshTokenValidator
The default implementation of
RefreshTokenGenerator
and RefreshTokenValidator
.
Create and verify a JWS encoded object whose payload is a UUID with a hash-based message authentication code (HMAC).- Since:
- 2.0.0
- Author:
- Sergio del Amo
- See Also:
-
Constructor Summary
-
Method Summary
-
Constructor Details
-
SignedRefreshTokenGenerator
- Parameters:
config
- Signed Refresh Token generator
-
-
Method Details
-
createKey
- Specified by:
createKey
in interfaceRefreshTokenGenerator
- Parameters:
authentication
- The user details- Returns:
- The internal value that will persisted.
-
generate
@NonNull public @NonNull Optional<String> generate(@NonNull @NonNull Authentication authentication, @NonNull @NonNull String token) - Specified by:
generate
in interfaceRefreshTokenGenerator
- Parameters:
authentication
- The user detailstoken
- The internal value- Returns:
- The refresh token
-
validate
- Specified by:
validate
in interfaceRefreshTokenValidator
- Parameters:
refreshToken
- The refresh token- Returns:
- The validated token wrapped in an Optional or Optional#empty() if the supplied token is invalid.
-