Interface RefreshTokenProvider
- All Superinterfaces:
Provider
- All Known Implementing Classes:
AbstractRefreshTokenProvider,DefaultRefreshTokenProvider,OID4VCIRefreshTokenProvider
Provider responsible for verification of refresh tokens and issuing of new refresh tokens
-
Method Summary
Modifier and TypeMethodDescriptiondefault voidclose()generateRefreshToken(InitialRefreshTokenContext initialRefreshTokenCtx) Method is triggered during initial issuance of refresh token - usually after successful user authentication.Returns the provider ID that this instance uses to identify issued refresh tokens.Invoked during refresh-token request.voidrevokeToken(AccessToken token, UserModel user, ClientModel client, EventBuilder event) Invoked when the revocation endpoint receives a request to revoke a refresh token issued by this provider.booleansupports(InitialRefreshTokenContext initialRefreshTokenCtx) Method is triggered during initial issuance of refresh token - usually after successful user authentication.booleanInvoked during refresh-token request.
-
Method Details
-
supports
Method is triggered during initial issuance of refresh token - usually after successful user authentication.- Parameters:
initialRefreshTokenCtx- context information with the data useful to determine if this provider can be used to generate refresh token- Returns:
- true if this provider can be used to generate refresh token. In this case method
generateRefreshToken(InitialRefreshTokenContext)would be used for this provider to generate new refresh token. Keycloak iterates over available providers to determine which one can be used. Providers are sorted by their priority (based on the "order" of particular ProviderFactory)
-
generateRefreshToken
RefreshToken generateRefreshToken(InitialRefreshTokenContext initialRefreshTokenCtx) throws RefreshTokenException Method is triggered during initial issuance of refresh token - usually after successful user authentication. Refresh token is generated by single provider, which was first available provider returned by methodsupports(InitialRefreshTokenContext)- Parameters:
initialRefreshTokenCtx- context information with the data useful to determine- Returns:
- newly generated refresh token
- Throws:
RefreshTokenException- in case of some issues during refresh token generation
-
supports
Invoked during refresh-token request.- Parameters:
ctx- Context, which contains old refresh token and some other data- Returns:
- True if this provider supports verification of the refresh token from the context
-
refreshAccessToken
TokenManager.AccessTokenResponseBuilder refreshAccessToken(RefreshTokenContext ctx) throws OAuthErrorException Invoked during refresh-token request. Implements verifications related to old refresh token and creates token-response if all the verifications are successful- Parameters:
ctx- Context, which contains old refresh token and some other data- Returns:
- successful token-response with new tokens and data, which would be returned in the successful token response
- Throws:
OAuthErrorException- In case that validation failed or some other issue happened during token refresh
-
revokeToken
Invoked when the revocation endpoint receives a request to revoke a refresh token issued by this provider. The default implementation is a no-op; override to perform provider-specific cleanup (e.g., revoking associated credentials).- Parameters:
token- the decoded token (refresh/offline) represented as anAccessTokenuser- the token subjectclient- the client for which the token was issuedevent- the event builder for recording revocation events
-
getProviderId
String getProviderId()Returns the provider ID that this instance uses to identify issued refresh tokens. Used for event detail emission during initial issuance and refresh-token processing when the token does not carry a provider claim -
close
default void close()
-