Class AMLoginContext


  • public class AMLoginContext
    extends Object
    AMLoginContext class is the core layer in the authentication middle tier which connects user clients to the JAAS LoginModule. The AMLoginContext executes pre and post authentication process based on authentication status.

    AMLoginContext provides a synchronous layer on top of the JAAS framework for appropriate user interaction and communication between clients and authentication module via callbacks requirements

    AMLoginContext sets and retrieves the authentication configuration entry

    This class actually starts the JAAS login process by instantiating the LoginContext object with the JAAS configuration name and the CallbackHandler followed by calling the LoginContext::login() method.

    • Field Detail

      • authThread

        public static AuthThreadManager authThread
        AuthThreadManager associated with this AMLoginContext.
    • Constructor Detail

      • AMLoginContext

        public AMLoginContext​(AuthContextLocal authContext)
        Creates AMLoginContext object.
        Parameters:
        authContext - AuthContextLocal object. Must not be null;
    • Method Detail

      • resetJAASConfig

        public static void resetJAASConfig()
        Sets the JAAS configuration to the default container's configuration.
      • executeLogin

        public void executeLogin​(Subject subject,
                                 AuthContext.IndexType loginIndexType,
                                 String loginIndexName,
                                 String locale,
                                 String redirectUrl)
                          throws AuthLoginException
        Starts login process, the map passed to this method is the parameters required to start the login process. These parameters are indexType, indexName , principal, subject, password, organization name. Based on these parameters Module Configuration name is retrieved using Configuration component. Creates a new LoginContext and starts login process and returns. On error LoginException is thrown.
        Throws:
        AuthLoginException - if execute login fails
      • runLogin

        public void runLogin()
        Starts the login process ,calls JAAS Login Context
      • getRequiredInfo

        public Callback[] getRequiredInfo()
        Returns array of received callbacks from module.
        Returns:
        array of received callbacks from module.
      • submitRequiredInfo

        public void submitRequiredInfo​(Callback[] callback)
        Sets the submitted requirements, called by AuthContext.submitRequirements authContext.getLoginState().setSubmittedCallback is update.
        Parameters:
        callback - submit the required Callbacks
      • submitCallbackInfo

        public Callback[] submitCallbackInfo()
        CallbackHandler calls this to retrieve the submitted credentials/callbacks waits till authContext.getLoginState().setSubmittedCallback is set OR LoginStatus is not AUTH_IN_PROGRESS.
        Returns:
        submitted credentials/callbacks.
      • getStatus

        public int getStatus()
        Returns the authentication status.
        Returns:
        the authentication status.
      • getLoginState

        public LoginState getLoginState()
        Returns login state for the authentication context.
        Returns:
        login state for the authentication context.
      • getModuleInstanceNames

        public Set<String> getModuleInstanceNames()
        Returns authentication modules configured for a given organization.
        Returns:
        authentication modules configured for a given organization.
      • getOrganizationName

        public String getOrganizationName()
        Returns organization/suborganization for a request.
        Returns:
        organization/suborganization for a request.
      • getSSOToken

        public SSOToken getSSOToken()
        Returns Single Sign On Token for authenticated user, returns null if session is inactive.
        Returns:
        Single Sign On Token for authenticated user.
      • getSuccessURL

        public String getSuccessURL()
        Returns Login Success URL for authenticated user.
        Returns:
        Login Success URL for authenticated user.
      • getFailureURL

        public String getFailureURL()
        Returns Login Failure URL for authenticated user.
        Returns:
        Login Failure URL for authenticated user.
      • getAuthIdentifier

        public String getAuthIdentifier()
        Returns the current authIdentifier of the authentication process as String Session ID.
        Returns:
        authIdentifier of the authentication process.
      • getSubject

        public Subject getSubject()
        Returns the subject of authenticated user.
        Returns:
        the subject of authenticated user.
      • getLoginContext

        public LoginContext getLoginContext()
        Returns current login context
        Returns:
        login context
      • getErrorTemplate

        public String getErrorTemplate()
        Returns error template.
        Returns:
        error template.
      • getErrorMessage

        public String getErrorMessage()
        Returns error message.
        Returns:
        error message.
      • getErrorCode

        public String getErrorCode()
        Returns error code.
        Returns:
        Authentication error code.
      • getLockoutMsg

        public String getLockoutMsg()
        Gets the account lockout message
        Returns:
        account lockout message
      • isLockedOut

        public boolean isLockedOut()
        Checks if the account is locked
        Returns:
        true if account is locked
      • isPureJAAS

        public boolean isPureJAAS()
        Checks if is pure JAAS mode
        Returns:
        true if pure JAAS