Class Login


  • public class Login
    extends Object
    Login Manager
    Version:
    $Id: Login.java,v 1.6 2006/10/02 05:19:06 jjanke Exp $
    Author:
    Jorg Janke, victor.perez@e-evolution.com, e-Evolution http://www.e-evolution.com
  • Incorrect global Variable when you use multi Account Schema https://sourceforge.net/p/adempiere/bugs/1713/, teo.sarca@gmail.com
  • BF [ 2867246 ] Do not show InTrazit WHs on login https://sourceforge.net/p/adempiere/bugs/2136/
    • Constructor Detail

      • Login

        public Login​(Properties ctx)
        Login
        Parameters:
        ctx - context
    • Method Detail

      • getLoginErrMsg

        public String getLoginErrMsg()
      • isPasswordExpired

        public boolean isPasswordExpired()
      • initTest

        public static Properties initTest​(boolean isClient)
        Test Init - Set Environment for tests
        Parameters:
        isClient - client session
        Returns:
        Context
      • isJavaOK

        public static boolean isJavaOK​(boolean isClient)
        Java Version Test
        Parameters:
        isClient - client connection
        Returns:
        true if Java Version is OK
      • getRoles

        protected KeyNamePair[] getRoles​(CConnection cc,
                                         String app_user,
                                         String app_pwd,
                                         boolean force)
        Deprecated.
        (Test) Client Login.

        - Get Connection - Compare User info

        Sets Context with login info

        Parameters:
        cc - connection
        app_user - user
        app_pwd - pwd
        force - ignore pwd
        Returns:
        Array of Role KeyNamePair or null if error The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
      • getRoles

        public KeyNamePair[] getRoles​(Principal app_user)
        Deprecated.
        use public KeyNamePair[] getRoles(String app_user, KeyNamePair client)
        (Web) Client Login.

        Compare User Info

        Sets Context with login info

        Parameters:
        app_user - Principal
        Returns:
        role array or null if in error. The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
      • getRoles

        public KeyNamePair[] getRoles​(String app_user,
                                      String app_pwd)
        Deprecated.
        use public KeyNamePair[] getRoles(String app_user, KeyNamePair client)
        Client Login.

        Compare User Info

        Sets Context with login info

        Parameters:
        app_user - user id
        app_pwd - password
        Returns:
        role array or null if in error. The error (NoDatabase, UserPwdError, DBLogin) is saved in the log
      • getClients

        public KeyNamePair[] getClients​(KeyNamePair role)
        Load Clients.

        Sets Role info in context and loads its clients

        Parameters:
        role - role information
        Returns:
        list of valid client KeyNodePairs or null if in error
      • getOrgs

        public KeyNamePair[] getOrgs​(KeyNamePair rol)
        Load Organizations.

        Sets Client info in context and loads its organization, the role has access to

        Parameters:
        rol -
        Returns:
        list of valid Org KeyNodePairs or null if in error
      • getWarehouses

        public KeyNamePair[] getWarehouses​(KeyNamePair org)
        Load Warehouses
        Parameters:
        org - organization
        Returns:
        Array of Warehouse Info
      • validateLogin

        public String validateLogin​(KeyNamePair org)
        Validate Login
        Parameters:
        org - log-in org
        Returns:
        error message
      • loadPreferences

        public String loadPreferences​(KeyNamePair org,
                                      KeyNamePair warehouse,
                                      Timestamp timestamp,
                                      String printerName)
        Load Preferences into Context for selected client.

        Sets Org info in context and loads relevant field from - AD_Client/Info, - C_AcctSchema, - C_AcctSchema_Elements - AD_Preference

        Assumes that the context is set for #AD_Client_ID, #AD_User_ID, #AD_Role_ID

        Parameters:
        org - org information
        warehouse - optional warehouse information
        timestamp - optional date
        printerName - optional printer info
        Returns:
        AD_Message of error (NoValidAcctInfo) or ""
      • loadUserPreferences

        public void loadUserPreferences()
        Load preferences based on user
      • batchLogin

        public boolean batchLogin​(Timestamp loginDate)
        Batch Login using Ini values Adempiere.startup(true); Ini.setProperty(Ini.P_UID,"SuperUser"); Ini.setProperty(Ini.P_PWD,"System"); Ini.setProperty(Ini.P_ROLE,"GardenAdmin"); Ini.setProperty(Ini.P_CLIENT, "Garden World"); Ini.setProperty(Ini.P_ORG,"HQ"); Ini.setProperty(Ini.P_WAREHOUSE,"HQ"); Ini.setProperty(Ini.P_LANGUAGE,"English"); Ini.setProperty(Ini.P_PRINTER,"MyPrinter"); Login login = new Login(Env.getCtx()); login.batchLogin();
        Parameters:
        loginDate - optional login date
        Returns:
        true if logged in using Ini values
      • batchLogin

        public boolean batchLogin()
        Batch Login with system date
        Returns:
        true if logged in
      • getPrincipal

        public Principal getPrincipal()
        Get SSO Principal
        Returns:
        principal
      • getClients

        public KeyNamePair[] getClients​(String app_user,
                                        String app_pwd,
                                        String roleTypes)
        Validate Client Login. Sets Context with login info
        Parameters:
        app_user - user id
        app_pwd - password
        roleTypes - comma separated list of the role types allowed to login (NULL can be added)
        Returns:
        client array or null if in error.
      • getRoles

        public KeyNamePair[] getRoles​(String app_user,
                                      KeyNamePair client,
                                      String roleTypes)
        Load Roles.

        Sets Client info in context and loads its roles

        Parameters:
        client - client information
        roleTypes - comma separated list of the role types allowed to login (NULL can be added)
        Returns:
        list of valid roles KeyNodePairs or null if in error
      • isMFARequired

        public boolean isMFARequired​(String registerCookie)
        Validate if MFA is required taking into account the registerCookie and the IPAddress
        Parameters:
        registerCookie -
        Returns: