Class OID4VCIRefreshTokenProvider
java.lang.Object
org.keycloak.protocol.oidc.refresh.AbstractRefreshTokenProvider
org.keycloak.protocol.oid4vc.refresh.OID4VCIRefreshTokenProvider
- All Implemented Interfaces:
RefreshTokenProvider,Provider
public class OID4VCIRefreshTokenProvider
extends AbstractRefreshTokenProvider
implements RefreshTokenProvider
-
Field Summary
Fields inherited from class org.keycloak.protocol.oidc.refresh.AbstractRefreshTokenProvider
session -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterRefreshTokenGenerated(RefreshTokenContext ctx, TokenManager.AccessTokenResponseBuilder responseBuilder) Callback method invoked after refresh token is generatedprotected IssuedVerifiableCredentialModelcheckIssuedVerifiableCredential(KeycloakSession session, UserModel user, String issuedCredentialId, CredentialScopeModel expectedCredentialScope, ClientModel expectedClient) 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.protected UserModelgetUser(RealmModel realm, RefreshToken oldToken) 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.protected TokenManager.TokenValidationvalidateToken(KeycloakSession session, jakarta.ws.rs.core.UriInfo uriInfo, ClientConnection connection, RealmModel realm, RefreshToken oldToken, jakarta.ws.rs.core.HttpHeaders headers, String scope, ClientModel client, TokenManager tokenManager, EventBuilder event) Validation specific to the particular refreshToken provider type.Methods inherited from class org.keycloak.protocol.oidc.refresh.AbstractRefreshTokenProvider
createRefreshToken, refreshAccessTokenMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.protocol.oidc.refresh.RefreshTokenProvider
close, refreshAccessToken
-
Constructor Details
-
OID4VCIRefreshTokenProvider
-
-
Method Details
-
supports
Description copied from interface:RefreshTokenProviderMethod is triggered during initial issuance of refresh token - usually after successful user authentication.- Specified by:
supportsin interfaceRefreshTokenProvider- 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
RefreshTokenProvider.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
public RefreshToken generateRefreshToken(InitialRefreshTokenContext initialRefreshTokenCtx) throws RefreshTokenException Description copied from interface:RefreshTokenProviderMethod 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 methodRefreshTokenProvider.supports(InitialRefreshTokenContext)- Specified by:
generateRefreshTokenin interfaceRefreshTokenProvider- 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
Description copied from interface:RefreshTokenProviderInvoked during refresh-token request.- Specified by:
supportsin interfaceRefreshTokenProvider- 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
-
validateToken
protected TokenManager.TokenValidation validateToken(KeycloakSession session, jakarta.ws.rs.core.UriInfo uriInfo, ClientConnection connection, RealmModel realm, RefreshToken oldToken, jakarta.ws.rs.core.HttpHeaders headers, String scope, ClientModel client, TokenManager tokenManager, EventBuilder event) throws OAuthErrorException Description copied from class:AbstractRefreshTokenProviderValidation specific to the particular refreshToken provider type. For example this could be validation if related user session still exists and is not expired etc.- Specified by:
validateTokenin classAbstractRefreshTokenProvider- Returns:
- token validation with successful context information
- Throws:
OAuthErrorException- In case that some validation failed
-
afterRefreshTokenGenerated
protected void afterRefreshTokenGenerated(RefreshTokenContext ctx, TokenManager.AccessTokenResponseBuilder responseBuilder) Description copied from class:AbstractRefreshTokenProviderCallback method invoked after refresh token is generated- Specified by:
afterRefreshTokenGeneratedin classAbstractRefreshTokenProvider- Parameters:
ctx- contextresponseBuilder- response builder with already filled refresh token and client session context
-
revokeToken
Description copied from interface:RefreshTokenProviderInvoked 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).- Specified by:
revokeTokenin interfaceRefreshTokenProvider- 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
Description copied from interface:RefreshTokenProviderReturns 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- Specified by:
getProviderIdin interfaceRefreshTokenProvider
-
getUser
-
checkIssuedVerifiableCredential
protected IssuedVerifiableCredentialModel checkIssuedVerifiableCredential(KeycloakSession session, UserModel user, String issuedCredentialId, CredentialScopeModel expectedCredentialScope, ClientModel expectedClient)
-