Class DefaultActionToken

All Implemented Interfaces:
Serializable, SingleUseObjectKeyModel, SingleUseObjectValueModel, Token
Direct Known Subclasses:
ExecuteActionsActionToken, IdpVerifyAccountLinkActionToken, ResetCredentialsActionToken, UpdateEmailActionToken, VerifyEmailActionToken

public class DefaultActionToken extends DefaultActionTokenKey implements SingleUseObjectValueModel
Part of action token that is intended to be used e.g. in link sent in password-reset email. The token encapsulates user, expected action and its time of expiry.
Author:
hmlnarik
See Also:
  • Field Details

  • Constructor Details

    • DefaultActionToken

      public DefaultActionToken()
      Single-use random value used for verification whether the relevant action is allowed.
    • DefaultActionToken

      protected DefaultActionToken(String userId, String actionId, int absoluteExpirationInSecs, UUID actionVerificationNonce)
      Parameters:
      userId - User ID
      actionId - Action ID
      absoluteExpirationInSecs - Absolute expiration time in seconds in timezone of Keycloak.
      actionVerificationNonce -
    • DefaultActionToken

      protected DefaultActionToken(String userId, String actionId, int absoluteExpirationInSecs, UUID actionVerificationNonce, String compoundAuthenticationSessionId)
      Parameters:
      userId - User ID
      actionId - Action ID
      absoluteExpirationInSecs - Absolute expiration time in seconds in timezone of Keycloak.
      actionVerificationNonce -
  • Method Details

    • getCompoundAuthenticationSessionId

      public String getCompoundAuthenticationSessionId()
    • setCompoundAuthenticationSessionId

      public void setCompoundAuthenticationSessionId(String compoundAuthenticationSessionId)
    • getNotes

      public Map<String,String> getNotes()
      Description copied from interface: SingleUseObjectValueModel
      Returns unmodifiable map of all notes.
      Specified by:
      getNotes in interface SingleUseObjectValueModel
      Returns:
      see description. Returns empty map if no note is set, never returns null.
    • getNote

      public String getNote(String name)
      Description copied from interface: SingleUseObjectValueModel
      Returns value of the given note (or null when no note of this name is present)
      Specified by:
      getNote in interface SingleUseObjectValueModel
      Returns:
      see description
    • setNote

      public final String setNote(String name, String value)
      Sets value of the given note
      Returns:
      original value (or null when no value was present)
    • removeNote

      public final String removeNote(String name)
      Removes given note, and returns original value (or null when no value was present)
      Returns:
      see description
    • setEmail

      public void setEmail(String email)
    • getEmail

      public String getEmail()
    • serialize

      public String serialize(KeycloakSession session, RealmModel realm, jakarta.ws.rs.core.UriInfo uri)
      Updates the following fields and serializes this token into a signed JWT. The list of updated fields follows:
      • id: random nonce
      • issuedAt: Current time
      • issuer: URI of the given realm
      • audience: URI of the given realm (same as issuer)
      Parameters:
      session -
      realm -
      uri -
      Returns: