Class AbstractRefreshTokenProvider

java.lang.Object
org.keycloak.protocol.oidc.refresh.AbstractRefreshTokenProvider
All Implemented Interfaces:
RefreshTokenProvider, org.keycloak.provider.Provider
Direct Known Subclasses:
DefaultRefreshTokenProvider, OID4VCIRefreshTokenProvider

public abstract class AbstractRefreshTokenProvider extends Object implements RefreshTokenProvider
  • Field Details

    • session

      protected final org.keycloak.models.KeycloakSession session
  • Constructor Details

    • AbstractRefreshTokenProvider

      protected AbstractRefreshTokenProvider(org.keycloak.models.KeycloakSession session)
  • Method Details

    • refreshAccessToken

      public TokenManager.AccessTokenResponseBuilder refreshAccessToken(RefreshTokenContext ctx) throws org.keycloak.OAuthErrorException
      Description copied from interface: RefreshTokenProvider
      Invoked during refresh-token request. Implements verifications related to old refresh token and creates token-response if all the verifications are successful
      Specified by:
      refreshAccessToken in interface RefreshTokenProvider
      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:
      org.keycloak.OAuthErrorException - In case that validation failed or some other issue happened during token refresh
    • validateToken

      protected abstract TokenManager.TokenValidation validateToken(org.keycloak.models.KeycloakSession session, jakarta.ws.rs.core.UriInfo uriInfo, org.keycloak.common.ClientConnection connection, org.keycloak.models.RealmModel realm, org.keycloak.representations.RefreshToken oldToken, jakarta.ws.rs.core.HttpHeaders headers, String scope, org.keycloak.models.ClientModel client, TokenManager tokenManager, org.keycloak.events.EventBuilder event) throws org.keycloak.OAuthErrorException
      Validation specific to the particular refreshToken provider type. For example this could be validation if related user session still exists and is not expired etc.
      Returns:
      token validation with successful context information
      Throws:
      org.keycloak.OAuthErrorException - In case that some validation failed
    • afterRefreshTokenGenerated

      protected abstract void afterRefreshTokenGenerated(RefreshTokenContext ctx, TokenManager.AccessTokenResponseBuilder responseBuilder)
      Callback method invoked after refresh token is generated
      Parameters:
      ctx - context
      responseBuilder - response builder with already filled refresh token and client session context
    • createRefreshToken

      protected org.keycloak.representations.RefreshToken createRefreshToken(org.keycloak.representations.AccessToken accessToken, org.keycloak.representations.AccessToken.Confirmation confirmation, String provider)