Package org.openbravo.base.secureApp
Class LoginUtils
- java.lang.Object
-
- org.openbravo.base.secureApp.LoginUtils
-
public class LoginUtils extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
LoginUtils.RoleDefaults
Utility class to store login defaults
-
Field Summary
Fields Modifier and Type Field Description static org.apache.logging.log4j.Logger
log4j
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static String
buildClientList(List<RoleOrganization> roleorglist)
static String
buildOrgList(List<RoleOrganization> roleorglist)
static String
checkUserPassword(ConnectionProvider connectionProvider, String login, String unHashedPassword)
Similar togetValidUserId(ConnectionProvider, String, String)
but not blocking user accounts.static boolean
fillSessionArguments(ConnectionProvider conn, VariablesSecureApp vars, String strUserAuth, String strLanguage, String strIsRTL, String strRol, String strCliente, String strOrg, String strAlmacen)
static String
getDefaultLanguage(ConnectionProvider connectionProvider, String aduserid)
Returns default languagestatic String
getDefaultWarehouse(ConnectionProvider connectionProvider, String strClient, String strOrg, String strRole)
Returns default warehouse for a given organizationstatic LoginUtils.RoleDefaults
getLoginDefaults(String strUserAuth, String role, ConnectionProvider cp)
Obtains defaults defined for a user and throws DefaultValidationException in case they are not correct.static String
getValidUserId(ConnectionProvider connectionProvider, String login, String unHashedPassword)
Returns a userId which matches the login and password.static String
isDefaultRtl(ConnectionProvider connectionProvider, String aduserid)
Returns default value for Rtlstatic List<RoleOrganization>
loadRoleOrganization(String strRol)
static void
readNumberFormat(VariablesSecureApp vars, String strFormatFile)
Reads the number format from the format file and sets it in VariablesSecureAppstatic void
saveLoginBD(javax.servlet.http.HttpServletRequest request, VariablesSecureApp vars, String strCliente, String strOrganizacion)
It saves session in the DB when logging in
-
-
-
Method Detail
-
getValidUserId
public static String getValidUserId(ConnectionProvider connectionProvider, String login, String unHashedPassword)
Returns a userId which matches the login and password. If no user is found then null is returned. The combination of login and password is used to find the user. Blocking users is taking into account Note that only active users are returned.- Parameters:
connectionProvider
- , see theDalConnectionProvider
for an instance of a ConnectionProvider for the DAL.login
- the loginunHashedPassword
- the password, the unhashed password as it is entered by the user.- Returns:
- the user id or null if no user could be found or the user is locked.
- See Also:
PasswordHash
-
checkUserPassword
public static String checkUserPassword(ConnectionProvider connectionProvider, String login, String unHashedPassword)
Similar togetValidUserId(ConnectionProvider, String, String)
but not blocking user accounts.
-
loadRoleOrganization
public static List<RoleOrganization> loadRoleOrganization(String strRol)
-
buildClientList
public static String buildClientList(List<RoleOrganization> roleorglist)
-
buildOrgList
public static String buildOrgList(List<RoleOrganization> roleorglist)
-
fillSessionArguments
public static boolean fillSessionArguments(ConnectionProvider conn, VariablesSecureApp vars, String strUserAuth, String strLanguage, String strIsRTL, String strRol, String strCliente, String strOrg, String strAlmacen) throws javax.servlet.ServletException
- Throws:
javax.servlet.ServletException
-
getLoginDefaults
public static LoginUtils.RoleDefaults getLoginDefaults(String strUserAuth, String role, ConnectionProvider cp) throws javax.servlet.ServletException, DefaultValidationException
Obtains defaults defined for a user and throws DefaultValidationException in case they are not correct.- Throws:
javax.servlet.ServletException
DefaultValidationException
-
readNumberFormat
public static void readNumberFormat(VariablesSecureApp vars, String strFormatFile)
Reads the number format from the format file and sets it in VariablesSecureApp
-
saveLoginBD
public static void saveLoginBD(javax.servlet.http.HttpServletRequest request, VariablesSecureApp vars, String strCliente, String strOrganizacion) throws javax.servlet.ServletException
It saves session in the DB when logging in- Throws:
javax.servlet.ServletException
-
getDefaultLanguage
public static String getDefaultLanguage(ConnectionProvider connectionProvider, String aduserid) throws javax.servlet.ServletException
Returns default language- Throws:
javax.servlet.ServletException
-
isDefaultRtl
public static String isDefaultRtl(ConnectionProvider connectionProvider, String aduserid) throws javax.servlet.ServletException
Returns default value for Rtl- Throws:
javax.servlet.ServletException
-
getDefaultWarehouse
public static String getDefaultWarehouse(ConnectionProvider connectionProvider, String strClient, String strOrg, String strRole) throws javax.servlet.ServletException
Returns default warehouse for a given organization- Throws:
javax.servlet.ServletException
-
-