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() |
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) |
void |
postInit(KeycloakSessionFactory factory) |
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, wait
getVerifiers, handleToken
order
public ActionTokenHandler<T> create(KeycloakSession session)
create
in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>
public void init(Config.Scope config)
init
in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>
public void postInit(KeycloakSessionFactory factory)
postInit
in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>
public String getId()
getId
in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>
public void close()
close
in interface Provider
close
in interface ProviderFactory<ActionTokenHandler<T extends JsonWebToken>>
public Class<T> getTokenClass()
ActionTokenHandler
getTokenClass
in interface ActionTokenHandler<T extends JsonWebToken>
public EventType eventType()
ActionTokenHandler
EventBuilder
class.eventType
in interface ActionTokenHandler<T extends JsonWebToken>
public String getDefaultErrorMessage()
ActionTokenHandler
getDefaultErrorMessage
in interface ActionTokenHandler<T extends JsonWebToken>
public String getDefaultEventError()
ActionTokenHandler
EventBuilder
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)
ActionTokenHandler
getAuthenticationSessionIdFromToken
in interface ActionTokenHandler<T extends JsonWebToken>
token
- Token. Can be null
currentAuthSession
- Authentication session that is currently in progress, null
if no authentication session is not setnull
if the token does not contain authentication session ID)AuthenticationSessionCompoundId
public AuthenticationSessionModel startFreshAuthenticationSession(T token, ActionTokenContext<T> tokenContext)
ActionTokenHandler
startFreshAuthenticationSession
in interface ActionTokenHandler<T extends JsonWebToken>
public boolean canUseTokenRepeatedly(T token, ActionTokenContext<T> tokenContext)
ActionTokenHandler
true
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.