java.lang.Object
org.keycloak.authentication.authenticators.util.AcrStore

public class AcrStore extends Object
CRUD data in the authentication session, which are related to step-up authentication
Author:
Marek Posolda
  • Constructor Details

  • Method Details

    • isLevelOfAuthenticationForced

      public boolean isLevelOfAuthenticationForced()
    • getRequestedLevelOfAuthentication

      public int getRequestedLevelOfAuthentication(AuthenticationFlowModel executionModel)
    • isLevelOfAuthenticationSatisfiedFromCurrentAuthentication

      public boolean isLevelOfAuthenticationSatisfiedFromCurrentAuthentication(AuthenticationFlowModel topFlow)
      Returns:
      true if the current authentication reached the requested level, see getEffectiveLevelOfAuthentication()
    • getEffectiveLevelOfAuthentication

      public int getEffectiveLevelOfAuthentication()
      Returns:
      the level reached by the current authentication, see getEffectiveLevelOfAuthentication(int, boolean)
    • getEffectiveLevelOfAuthentication

      public static int getEffectiveLevelOfAuthentication(int level, boolean ssoAuthentication)
      Level reached by an authentication, shared by the enforcement of a requested level and by the ACR protocol mapper. A recorded level wins. Without one, an active authentication is Constants.DEFAULT_AUTHENTICATED_LOA and an authentication satisfied solely by the SSO cookie is Constants.MINIMUM_LOA.
      Parameters:
      level - level recorded for the authentication, Constants.NO_LOA if none
      ssoAuthentication - true if the authentication was satisfied solely by the SSO cookie
      Returns:
      the effective level, never lower than Constants.MINIMUM_LOA
    • getCurrentLevelOfAuthentication

      public static int getCurrentLevelOfAuthentication(AuthenticatedClientSessionModel clientSession)
    • isLevelAuthenticatedInPreviousAuth

      public boolean isLevelAuthenticatedInPreviousAuth(int level, int maxAge)
      Parameters:
      level - level of authentication
      maxAge - maxAge for which this level is considered valid
      Returns:
      True if the particular level was already authenticated before in this userSession and is still valid
    • getLevelOfAuthenticationFromCurrentAuthentication

      public int getLevelOfAuthenticationFromCurrentAuthentication()
      return level, which was either: - directly authenticated in current authentication - or was already verified that can be re-used from previous authentication
      Returns:
      see above
    • setLevelAuthenticated

      public void setLevelAuthenticated(int level)
      Save authenticated level to authenticationSession (for current authentication) and loa map (for future authentications)
      Parameters:
      level - level to save
    • setLevelAuthenticatedToCurrentRequest

      public void setLevelAuthenticatedToCurrentRequest(int level)
      Set level to the current authentication session
      Parameters:
      level - , which was authenticated by user
    • setAuthFlowLevelAuthenticatedToCurrentRequest

      public void setAuthFlowLevelAuthenticatedToCurrentRequest(AuthenticationFlowModel completedFlow)
      Set the level assigned by the client policy flow selector to the current authentication session, if it is higher than the current level. It applies only when the completed flow is the flow the policy selected, so a registration or a reset credentials flow does not reach it.
      Parameters:
      completedFlow - top level flow which completed the authentication
    • getHighestAuthenticatedLevelFromPreviousAuthentication

      public int getHighestAuthenticatedLevelFromPreviousAuthentication(String flowId)
      Returns:
      highest authenticated level from previous authentication, which is still valid (not yet expired)