public abstract class AbstractActionTokenHander<T extends JsonWebToken> extends Object implements ActionTokenHandler<T>, ActionTokenHandlerFactory<T>
| Constructor and Description |
|---|
AbstractActionTokenHander(String id,
Class<T> tokenClass,
String defaultErrorMessage,
EventType defaultEventType,
String defaultEventError) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canUseTokenRepeatedly(T token,
ActionTokenContext<T> tokenContext)
Returns
true when the token can be used repeatedly to invoke the action, false when the token
is intended to be for single use only. |
void |
close()
This is called when the server shuts down.
|
ActionTokenHandler<T> |
create(KeycloakSession session) |
EventType |
eventType()
Returns a event type logged with
EventBuilder class. |
String |
getAuthenticationSessionIdFromToken(T token,
ActionTokenContext<T> tokenContext,
AuthenticationSessionModel currentAuthSession)
Returns a compound authentication session ID requested from within the given token that the handler should attempt to join.
|
String |
getDefaultErrorMessage()
Returns an error to be shown in the response when token handling fails and no more specific
error message is provided.
|
String |
getDefaultEventError()
Returns an error to be shown in the
EventBuilder detail when token handling fails and
no more specific error is provided. |
String |
getId() |
Class<T> |
getTokenClass()
Returns the Java token class for use with deserialization.
|
void |
init(Config.Scope config)
Only called once when the factory is first created.
|
void |
postInit(KeycloakSessionFactory factory)
Called after all provider factories have been initialized
|
AuthenticationSessionModel |
startFreshAuthenticationSession(T token,
ActionTokenContext<T> tokenContext)
Creates a fresh authentication session according to the information from the token.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetVerifiers, handleTokenorderpublic ActionTokenHandler<T> create(KeycloakSession session)
create in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>public void init(Config.Scope config)
ProviderFactoryinit in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>public void postInit(KeycloakSessionFactory factory)
ProviderFactorypostInit in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>public String getId()
getId in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>public void close()
ProviderFactoryclose in interface Providerclose in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>public Class<T> getTokenClass()
ActionTokenHandlergetTokenClass in interface ActionTokenHandler<T extends JsonWebToken>public EventType eventType()
ActionTokenHandlerEventBuilder class.eventType in interface ActionTokenHandler<T extends JsonWebToken>public String getDefaultErrorMessage()
ActionTokenHandlergetDefaultErrorMessage in interface ActionTokenHandler<T extends JsonWebToken>public String getDefaultEventError()
ActionTokenHandlerEventBuilder detail when token handling fails and
no more specific error is provided.getDefaultEventError in interface ActionTokenHandler<T extends JsonWebToken>public String getAuthenticationSessionIdFromToken(T token, ActionTokenContext<T> tokenContext, AuthenticationSessionModel currentAuthSession)
ActionTokenHandlergetAuthenticationSessionIdFromToken in interface ActionTokenHandler<T extends JsonWebToken>token - Token. Can be nullcurrentAuthSession - Authentication session that is currently in progress, null if no authentication session is not setnull if the token does not contain authentication session ID)AuthenticationSessionCompoundIdpublic AuthenticationSessionModel startFreshAuthenticationSession(T token, ActionTokenContext<T> tokenContext)
ActionTokenHandlerstartFreshAuthenticationSession in interface ActionTokenHandler<T extends JsonWebToken>public boolean canUseTokenRepeatedly(T token, ActionTokenContext<T> tokenContext)
ActionTokenHandlertrue when the token can be used repeatedly to invoke the action, false when the token
is intended to be for single use only.canUseTokenRepeatedly in interface ActionTokenHandler<T extends JsonWebToken>Copyright © 2021 JBoss by Red Hat. All rights reserved.