Class RecoveryAuthnCodesAction
java.lang.Object
org.keycloak.authentication.requiredactions.RecoveryAuthnCodesAction
- All Implemented Interfaces:
CredentialAction,CredentialRegistrator,RequiredActionFactory,RequiredActionProvider,EnvironmentDependentProviderFactory,Provider,ProviderFactory<RequiredActionProvider>
public class RecoveryAuthnCodesAction
extends Object
implements RequiredActionProvider, RequiredActionFactory, EnvironmentDependentProviderFactory, CredentialRegistrator
-
Field Summary
FieldsFields inherited from interface org.keycloak.authentication.RequiredActionFactory
MAX_AUTH_AGE_CONFIG_PROPERTIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()This is called when the server shuts down.create(KeycloakSession session) protected RecoveryAuthnCodesCredentialModelcreateFromValues(List<String> generatedCodes, Long generatedAtTime, String generatedUserLabel) voidevaluateTriggers(RequiredActionContext context) Called every time a user authenticates.Returns the metadata for each configuration property supported by this factory.getCredentialType(KeycloakSession session, AuthenticationSessionModel authenticationSession) Display text used in admin console to reference this required actiongetId()voidinit(Config.Scope config) Only called once when the factory is first created.Determines what type of support is provided for application-initiated actions.booleanFlag indicating whether the execution of the required action by the same circumstances (e.g.booleanisSupported(Config.Scope config) Check if the provider is supported and should be available based on the provider configuration.voidpostInit(KeycloakSessionFactory factory) Called after all provider factories have been initializedvoidprocessAction(RequiredActionContext reqActionContext) Called when a required action has form input you want to process.voidIf the user has a required action set, this method will be the initial call to obtain what to display to the user's browser.voidvalidateConfig(KeycloakSession session, RealmModel realm, RequiredActionConfigModel model) Allows users to validate the provided configuration for this required action.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.provider.ProviderFactory
dependsOn, orderMethods inherited from interface org.keycloak.authentication.RequiredActionFactory
isConfigurableMethods inherited from interface org.keycloak.authentication.RequiredActionProvider
getMaxAuthAge, getMaxAuthAge, initiatedActionCanceled
-
Field Details
-
PROVIDER_ID
-
WARNING_THRESHOLD
- See Also:
-
RECOVERY_CODES_WARNING_THRESHOLD_DEFAULT
public static final int RECOVERY_CODES_WARNING_THRESHOLD_DEFAULT- See Also:
-
-
Constructor Details
-
RecoveryAuthnCodesAction
public RecoveryAuthnCodesAction()
-
-
Method Details
-
getId
- Specified by:
getIdin interfaceProviderFactory<RequiredActionProvider>
-
getCredentialType
public String getCredentialType(KeycloakSession session, AuthenticationSessionModel authenticationSession) - Specified by:
getCredentialTypein interfaceCredentialAction- Returns:
- credential type, which this action is able to register. This should refer to the same value as returned by
CredentialProvider.getType()of the corresponding credential provider andConfigurableAuthenticatorFactory.getReferenceCategory()of the corresponding authenticator
-
getDisplayText
Description copied from interface:RequiredActionFactoryDisplay text used in admin console to reference this required action- Specified by:
getDisplayTextin interfaceRequiredActionFactory- Returns:
-
create
- Specified by:
createin interfaceProviderFactory<RequiredActionProvider>
-
init
Description copied from interface:ProviderFactoryOnly called once when the factory is first created. This config is pulled from keycloak_server.json- Specified by:
initin interfaceProviderFactory<RequiredActionProvider>
-
postInit
Description copied from interface:ProviderFactoryCalled after all provider factories have been initialized- Specified by:
postInitin interfaceProviderFactory<RequiredActionProvider>
-
isOneTimeAction
public boolean isOneTimeAction()Description copied from interface:RequiredActionFactoryFlag indicating whether the execution of the required action by the same circumstances (e.g. by one and the same action token) should only be permitted once.- Specified by:
isOneTimeActionin interfaceRequiredActionFactory- Returns:
-
initiatedActionSupport
Description copied from interface:RequiredActionProviderDetermines what type of support is provided for application-initiated actions.- Specified by:
initiatedActionSupportin interfaceRequiredActionProvider- Returns:
- InititatedActionsSupport
-
evaluateTriggers
Description copied from interface:RequiredActionProviderCalled every time a user authenticates. This checks to see if this required action should be triggered. The implementation of this method is responsible for setting the required action on the UserModel. For example, the UpdatePassword required actions checks the password policies to see if the password has expired.- Specified by:
evaluateTriggersin interfaceRequiredActionProvider
-
requiredActionChallenge
Description copied from interface:RequiredActionProviderIf the user has a required action set, this method will be the initial call to obtain what to display to the user's browser. Return null if no action should be done.- Specified by:
requiredActionChallengein interfaceRequiredActionProvider
-
processAction
Description copied from interface:RequiredActionProviderCalled when a required action has form input you want to process.- Specified by:
processActionin interfaceRequiredActionProvider
-
createFromValues
protected RecoveryAuthnCodesCredentialModel createFromValues(List<String> generatedCodes, Long generatedAtTime, String generatedUserLabel) -
close
public void close()Description copied from interface:ProviderFactoryThis is called when the server shuts down.- Specified by:
closein interfaceProvider- Specified by:
closein interfaceProviderFactory<RequiredActionProvider>
-
isSupported
Description copied from interface:EnvironmentDependentProviderFactoryCheck if the provider is supported and should be available based on the provider configuration.- Specified by:
isSupportedin interfaceEnvironmentDependentProviderFactory- Parameters:
config- the provider configuration- Returns:
trueif the provider is supported. Otherwise,false.
-
getConfigMetadata
Description copied from interface:ProviderFactoryReturns the metadata for each configuration property supported by this factory.- Specified by:
getConfigMetadatain interfaceProviderFactory<RequiredActionProvider>- Specified by:
getConfigMetadatain interfaceRequiredActionFactory- Returns:
- a list with the metadata for each configuration property supported by this factory
-
validateConfig
public void validateConfig(KeycloakSession session, RealmModel realm, RequiredActionConfigModel model) Description copied from interface:RequiredActionFactoryAllows users to validate the provided configuration for this required action. Users can throw aModelValidationExceptionto indicate that the configuration is invalid. Defaults validating max_auth_age value.- Specified by:
validateConfigin interfaceRequiredActionFactory
-