Package org.keycloak.authentication
Class AuthenticatorUtil
java.lang.Object
org.keycloak.authentication.AuthenticatorUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddAuthCredential(org.keycloak.sessions.AuthenticationSessionModel authSession, String credential) Adds the credentials to the credentials used in the authentication session.getAuthCallbacksFactoryIds(org.keycloak.sessions.AuthenticationSessionModel authSession) Get set of Authentication factories IDs defined in authentication session as CALLBACKS_FACTORY_IDS_NOTEgetAuthnCredentials(org.keycloak.sessions.AuthenticationSessionModel authSession) Get the list of credentials used in the authentication.static Stream<org.keycloak.credential.CredentialProvider>getCredentialProviders(org.keycloak.models.KeycloakSession session) static List<org.keycloak.models.AuthenticationExecutionModel>getExecutionsByType(org.keycloak.models.RealmModel realm, String flowId, String providerId) static org.keycloak.models.AuthenticationFlowModelgetTopParentFlow(org.keycloak.models.RealmModel realm, org.keycloak.models.AuthenticationExecutionModel executionModel) Useful if we need to find top-level flow from executionModelstatic booleanisForcedReauthentication(org.keycloak.sessions.AuthenticationSessionModel authSession) static booleanisForkedFlow(org.keycloak.sessions.AuthenticationSessionModel authSession) static booleanisPasswordValidated(org.keycloak.sessions.AuthenticationSessionModel authSession) static booleanisSSOAuthentication(org.keycloak.sessions.AuthenticationSessionModel authSession) static voidlogoutOtherSessions(DefaultActionToken token, ActionTokenContext<? extends DefaultActionToken> context) Logouts all sessions that are different to the current authentication session managed in the action token context.static voidlogoutOtherSessions(org.keycloak.authentication.RequiredActionContext context) Logouts all sessions that are different to the current authentication session managed in the action context.static voidsetAuthCallbacksFactoryIds(org.keycloak.sessions.AuthenticationSessionModel authSession, String authFactoryId) Set authentication session note for callbacks defined for {@link AuthenticationFlowCallbackFactory) factories
-
Field Details
-
CALLBACKS_FACTORY_IDS_NOTE
-
-
Constructor Details
-
AuthenticatorUtil
public AuthenticatorUtil()
-
-
Method Details
-
isSSOAuthentication
public static boolean isSSOAuthentication(org.keycloak.sessions.AuthenticationSessionModel authSession) -
isForcedReauthentication
public static boolean isForcedReauthentication(org.keycloak.sessions.AuthenticationSessionModel authSession) -
isPasswordValidated
public static boolean isPasswordValidated(org.keycloak.sessions.AuthenticationSessionModel authSession) -
isForkedFlow
public static boolean isForkedFlow(org.keycloak.sessions.AuthenticationSessionModel authSession) -
setAuthCallbacksFactoryIds
public static void setAuthCallbacksFactoryIds(org.keycloak.sessions.AuthenticationSessionModel authSession, String authFactoryId) Set authentication session note for callbacks defined for {@link AuthenticationFlowCallbackFactory) factories- Parameters:
authSession- authentication sessionauthFactoryId- authentication factory ID which should be added to the authentication session note
-
getAuthCallbacksFactoryIds
public static Set<String> getAuthCallbacksFactoryIds(org.keycloak.sessions.AuthenticationSessionModel authSession) Get set of Authentication factories IDs defined in authentication session as CALLBACKS_FACTORY_IDS_NOTE- Parameters:
authSession- authentication session- Returns:
- set of factories IDs
-
getExecutionsByType
public static List<org.keycloak.models.AuthenticationExecutionModel> getExecutionsByType(org.keycloak.models.RealmModel realm, String flowId, String providerId) - Parameters:
realm-flowId-providerId-- Returns:
- all executions of given "provider_id" type. This is deep (recursive) obtain of executions of the particular flow
-
getTopParentFlow
public static org.keycloak.models.AuthenticationFlowModel getTopParentFlow(org.keycloak.models.RealmModel realm, org.keycloak.models.AuthenticationExecutionModel executionModel) Useful if we need to find top-level flow from executionModel- Parameters:
realm-executionModel-- Returns:
- Top parent flow corresponding to given executionModel.
-
logoutOtherSessions
public static void logoutOtherSessions(org.keycloak.authentication.RequiredActionContext context) Logouts all sessions that are different to the current authentication session managed in the action context.- Parameters:
context- The required action context
-
logoutOtherSessions
public static void logoutOtherSessions(DefaultActionToken token, ActionTokenContext<? extends DefaultActionToken> context) Logouts all sessions that are different to the current authentication session managed in the action token context.- Parameters:
token- The action tokencontext- The required action token context
-
getCredentialProviders
public static Stream<org.keycloak.credential.CredentialProvider> getCredentialProviders(org.keycloak.models.KeycloakSession session) - Parameters:
session-- Returns:
- all credential providers available
-
getAuthnCredentials
public static List<String> getAuthnCredentials(org.keycloak.sessions.AuthenticationSessionModel authSession) Get the list of credentials used in the authentication.- Parameters:
authSession- The authentication session- Returns:
- The immutable list of credentials (empty returned if none)
-
addAuthCredential
public static void addAuthCredential(org.keycloak.sessions.AuthenticationSessionModel authSession, String credential) Adds the credentials to the credentials used in the authentication session.- Parameters:
authSession- The authentication sessioncredential- The credential to add
-