Class OID4VCIRefreshTokenProvider

java.lang.Object
org.keycloak.protocol.oidc.refresh.AbstractRefreshTokenProvider
org.keycloak.protocol.oid4vc.refresh.OID4VCIRefreshTokenProvider
All Implemented Interfaces:
RefreshTokenProvider, org.keycloak.provider.Provider

public class OID4VCIRefreshTokenProvider extends AbstractRefreshTokenProvider implements RefreshTokenProvider
  • Constructor Details

    • OID4VCIRefreshTokenProvider

      public OID4VCIRefreshTokenProvider(org.keycloak.models.KeycloakSession session)
  • Method Details

    • supports

      public boolean supports(InitialRefreshTokenContext initialRefreshTokenCtx)
      Description copied from interface: RefreshTokenProvider
      Method is triggered during initial issuance of refresh token - usually after successful user authentication.
      Specified by:
      supports in interface RefreshTokenProvider
      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 org.keycloak.representations.RefreshToken generateRefreshToken(InitialRefreshTokenContext initialRefreshTokenCtx) throws RefreshTokenException
      Description copied from interface: RefreshTokenProvider
      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 method RefreshTokenProvider.supports(InitialRefreshTokenContext)
      Specified by:
      generateRefreshToken in interface RefreshTokenProvider
      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

      public boolean supports(RefreshTokenContext ctx)
      Description copied from interface: RefreshTokenProvider
      Invoked during refresh-token request.
      Specified by:
      supports in interface RefreshTokenProvider
      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(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
      Description copied from class: AbstractRefreshTokenProvider
      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.
      Specified by:
      validateToken in class AbstractRefreshTokenProvider
      Returns:
      token validation with successful context information
      Throws:
      org.keycloak.OAuthErrorException - In case that some validation failed
    • afterRefreshTokenGenerated

      protected void afterRefreshTokenGenerated(RefreshTokenContext ctx, TokenManager.AccessTokenResponseBuilder responseBuilder)
      Description copied from class: AbstractRefreshTokenProvider
      Callback method invoked after refresh token is generated
      Specified by:
      afterRefreshTokenGenerated in class AbstractRefreshTokenProvider
      Parameters:
      ctx - context
      responseBuilder - response builder with already filled refresh token and client session context
    • getUser

      protected org.keycloak.models.UserModel getUser(org.keycloak.models.RealmModel realm, org.keycloak.representations.RefreshToken oldToken)
    • checkIssuedVerifiableCredential

      protected org.keycloak.models.IssuedVerifiableCredentialModel checkIssuedVerifiableCredential(org.keycloak.models.KeycloakSession session, org.keycloak.models.UserModel user, String issuedCredentialId, org.keycloak.models.oid4vci.CredentialScopeModel expectedCredentialScope, org.keycloak.models.ClientModel expectedClient)