Class DefaultActionToken
java.lang.Object
org.keycloak.representations.JsonWebToken
org.keycloak.models.DefaultActionTokenKey
org.keycloak.authentication.actiontoken.DefaultActionToken
- All Implemented Interfaces:
Serializable,SingleUseObjectKeyModel,SingleUseObjectValueModel,Token
- Direct Known Subclasses:
ExecuteActionsActionToken,IdpVerifyAccountLinkActionToken,InviteOrgActionToken,ResetCredentialsActionToken,UpdateEmailActionToken,VerifyEmailActionToken
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final TokenVerifier.Predicate<DefaultActionTokenKey>static final Stringstatic final StringFields inherited from class org.keycloak.models.DefaultActionTokenKey
ACTION_TOKEN_USER_ID, JSON_FIELD_ACTION_VERIFICATION_NONCE -
Constructor Summary
ConstructorsModifierConstructorDescriptionSingle-use random value used for verification whether the relevant action is allowed.protectedDefaultActionToken(String userId, String actionId, int absoluteExpirationInSecs, UUID actionVerificationNonce) protectedDefaultActionToken(String userId, String actionId, int absoluteExpirationInSecs, UUID actionVerificationNonce, String compoundAuthenticationSessionId) -
Method Summary
Modifier and TypeMethodDescriptiongetEmail()Returns value of the given note (ornullwhen no note of this name is present)getNotes()Returns unmodifiable map of all notes.final StringremoveNote(String name) Removes given note, and returns original value (ornullwhen no value was present)serialize(KeycloakSession session, RealmModel realm, jakarta.ws.rs.core.UriInfo uri) Updates the following fields and serializes this token into a signed JWT.voidsetCompoundAuthenticationSessionId(String compoundAuthenticationSessionId) voidfinal StringSets value of the given noteMethods inherited from class org.keycloak.models.DefaultActionTokenKey
from, getActionId, getActionVerificationNonce, getUserIdMethods inherited from class org.keycloak.representations.JsonWebToken
addAudience, audience, exp, getAudience, getCategory, getExp, getIat, getId, getIssuedFor, getIssuer, getNbf, getOtherClaims, getSubject, getType, hasAnyAudience, hasAudience, iat, id, isActive, isActive, isExpired, isIssuedBeforeSessionStart, isNotBefore, issuedFor, issuedNow, issuer, nbf, setOtherClaims, setSubject, subject, typeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.SingleUseObjectKeyModel
getExp, getExpiration, serializeKey
-
Field Details
-
JSON_FIELD_AUTHENTICATION_SESSION_ID
- See Also:
-
JSON_FIELD_EMAIL
- See Also:
-
ACTION_TOKEN_BASIC_CHECKS
-
-
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 IDactionId- Action IDabsoluteExpirationInSecs- 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 IDactionId- Action IDabsoluteExpirationInSecs- Absolute expiration time in seconds in timezone of Keycloak.actionVerificationNonce-
-
-
Method Details
-
getCompoundAuthenticationSessionId
-
setCompoundAuthenticationSessionId
-
getNotes
Description copied from interface:SingleUseObjectValueModelReturns unmodifiable map of all notes.- Specified by:
getNotesin interfaceSingleUseObjectValueModel- Returns:
- see description. Returns empty map if no note is set, never returns
null.
-
getNote
Description copied from interface:SingleUseObjectValueModelReturns value of the given note (ornullwhen no note of this name is present)- Specified by:
getNotein interfaceSingleUseObjectValueModel- Returns:
- see description
-
setNote
Sets value of the given note- Returns:
- original value (or
nullwhen no value was present)
-
removeNote
Removes given note, and returns original value (ornullwhen no value was present)- Returns:
- see description
-
setEmail
-
getEmail
-
serialize
Updates the following fields and serializes this token into a signed JWT. The list of updated fields follows:id: random nonceissuedAt: Current timeissuer: URI of the given realmaudience: URI of the given realm (same as issuer)
- Parameters:
session-realm-uri-- Returns:
-