Package org.apache.ofbiz.webapp.control
Class LoginWorker
java.lang.Object
org.apache.ofbiz.webapp.control.LoginWorker
Common Workers
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
autoChangePassword
(HttpServletRequest request, HttpServletResponse response) static String
autoLoginCheck
(HttpServletRequest request, HttpServletResponse response) static String
autoLoginRemove
(HttpServletRequest request, HttpServletResponse response) static String
autoLoginSet
(HttpServletRequest request, HttpServletResponse response) static String
check509CertLogin
(HttpServletRequest request, HttpServletResponse response) static GenericValue
checkImpersonationInProcess
(HttpServletRequest request, HttpServletResponse response) Return the activeGenericValue
of a current impersonation UserLoginHistory of current userLogin session, only if not the impersonator himself.static String
checkLogin
(HttpServletRequest request, HttpServletResponse response) An HTTP WebEvent handler that checks to see is a userLogin is logged in.static GenericValue
checkLogout
(HttpServletRequest request, HttpServletResponse response) static String
checkRequestHeaderLogin
(HttpServletRequest request, HttpServletResponse response) static String
checkServletRequestRemoteUserLogin
(HttpServletRequest request, HttpServletResponse response) protected static boolean
checkValidIssuer
(Delegator delegator, Map<String, String> x500Map, BigInteger serialNumber) static void
createSecuredLoginIdCookie
(HttpServletRequest request, HttpServletResponse response) static String
depersonateLogin
(HttpServletRequest request, HttpServletResponse response) An HTTP WebEvent handler to reverse an impersonate login.static void
doBasicLogin
(GenericValue userLogin, HttpServletRequest request, HttpServletResponse response) static void
doBasicLogout
(GenericValue userLogin, HttpServletRequest request, HttpServletResponse response) static String
doMainLogin
(HttpServletRequest request, HttpServletResponse response, GenericValue userLogin, Map<String, Object> userLoginSession) static String
extensionCheckLogin
(HttpServletRequest request, HttpServletResponse response) This WebEvent allows for java 'services' to hook into the login path.static String
extensionConnectLogin
(HttpServletRequest request, HttpServletResponse response) This WebEvent allows for java 'services' to hook into the login path.static Collection<ComponentConfig.WebappInfo>
getAppBarWebInfos
(Security security, GenericValue userLogin, String serverName, String menuName) Returns aCollection
ofWebappInfo
instances that the specified user is authorized to access.protected static String
getAutoLoginCookieName
(HttpServletRequest request) static String
getAutoUserLoginId
(HttpServletRequest request) protected static String
static String
getSecuredUserLoginId
(HttpServletRequest request) getUserLoginSession
(GenericValue userLogin) static boolean
hasApplicationPermission
(ComponentConfig.WebappInfo info, Security security, GenericValue userLogin) Returnstrue
if the specified user is authorized to access the specified web application.static boolean
hasBasePermission
(GenericValue userLogin, HttpServletRequest request) static String
impersonateLogin
(HttpServletRequest request, HttpServletResponse response) An HTTP WebEvent handler to impersonate a given userLogin without using password.static boolean
isFlaggedLoggedOut
(GenericValue userLogin, Delegator delegator) static boolean
isUserLoggedIn
(HttpServletRequest request) static boolean
isUserLoginActive
(GenericValue userLogin) Return true if userLogin has not been disabledstatic String
login
(HttpServletRequest request, HttpServletResponse response) An HTTP WebEvent handler that logs in a userLogin.static String
loginUserWithUserLoginId
(HttpServletRequest request, HttpServletResponse response, String userLoginId) This method will log in a user with only their username (userLoginId).static String
logout
(HttpServletRequest request, HttpServletResponse response) An HTTP WebEvent handler that logs out a userLogin by clearing the session.static StringUtil.StringWrapper
makeLoginUrl
(HttpServletRequest request) static StringUtil.StringWrapper
makeLoginUrl
(HttpServletRequest request, String requestName) static StringUtil.StringWrapper
makeLoginUrl
(javax.servlet.jsp.PageContext pageContext) static StringUtil.StringWrapper
makeLoginUrl
(javax.servlet.jsp.PageContext pageContext, String requestName) static void
setLoggedOut
(String userLoginId, Delegator delegator) protected static void
setWebContextObjects
(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher)
-
Constructor Details
-
LoginWorker
protected LoginWorker()
-
-
Method Details
-
makeLoginUrl
-
makeLoginUrl
-
makeLoginUrl
public static StringUtil.StringWrapper makeLoginUrl(javax.servlet.jsp.PageContext pageContext, String requestName) -
makeLoginUrl
-
setLoggedOut
-
checkLogout
-
checkImpersonationInProcess
public static GenericValue checkImpersonationInProcess(HttpServletRequest request, HttpServletResponse response) Return the activeGenericValue
of a current impersonation UserLoginHistory of current userLogin session, only if not the impersonator himself.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- GenericValue
-
extensionCheckLogin
This WebEvent allows for java 'services' to hook into the login path. This method loads all instances ofLoginCheck
, and calls theLoginCheck.associate(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
method. The first implementation to return a non-null value gets that value returned to the caller. Returning "none" will abort processing, while anything else gets looked up in outer view dispatch. This event is called when the current request needs to have a validly logged in user; it is a wrapper aroundcheckLogin(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- String
-
extensionConnectLogin
public static String extensionConnectLogin(HttpServletRequest request, HttpServletResponse response) This WebEvent allows for java 'services' to hook into the login path. This method loads all instances ofLoginCheck
, and calls theLoginCheck.check(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
method. The first implementation to return a non-null value gets that value returned to the caller. Returning "none" will abort processing, while anything else gets looked up in outer view dispatch; for preprocessors, only "success" makes sense.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- String
-
checkLogin
An HTTP WebEvent handler that checks to see is a userLogin is logged in. If not, the user is forwarded to the login page.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- String
-
login
An HTTP WebEvent handler that logs in a userLogin. This should run before the security check.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- Return a boolean which specifies whether or not the calling Servlet or JSP should generate its own content. This allows an event to override the default content.
-
impersonateLogin
An HTTP WebEvent handler to impersonate a given userLogin without using password. This should run before the security check.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- Return a boolean which specifies whether or not the calling Servlet or JSP should generate its own content. This allows an event to override the default content.
-
depersonateLogin
An HTTP WebEvent handler to reverse an impersonate login.- Parameters:
request
- The HTTP request object for the current JSP or Servlet request.response
- The HTTP response object for the current JSP or Servlet request.- Returns:
- Return a boolean which specifies whether or not the calling Servlet or JSP should generate its own content. This allows an event to override the default content.
-
setWebContextObjects
protected static void setWebContextObjects(HttpServletRequest request, HttpServletResponse response, Delegator delegator, LocalDispatcher dispatcher) -
doMainLogin
public static String doMainLogin(HttpServletRequest request, HttpServletResponse response, GenericValue userLogin, Map<String, Object> userLoginSession) -
doBasicLogin
public static void doBasicLogin(GenericValue userLogin, HttpServletRequest request, HttpServletResponse response) -
logout
An HTTP WebEvent handler that logs out a userLogin by clearing the session.- Parameters:
request
- The HTTP request object for the current request.response
- The HTTP response object for the current request.- Returns:
- Return a boolean which specifies whether or not the calling request should generate its own content. This allows an event to override the default content.
-
doBasicLogout
public static void doBasicLogout(GenericValue userLogin, HttpServletRequest request, HttpServletResponse response) -
autoLoginSet
-
createSecuredLoginIdCookie
public static void createSecuredLoginIdCookie(HttpServletRequest request, HttpServletResponse response) -
getAutoLoginCookieName
-
getSecuredLoginIdCookieName
-
getAutoUserLoginId
-
getSecuredUserLoginId
-
autoLoginCheck
-
autoLoginRemove
-
isUserLoggedIn
-
loginUserWithUserLoginId
public static String loginUserWithUserLoginId(HttpServletRequest request, HttpServletResponse response, String userLoginId) This method will log in a user with only their username (userLoginId).- Parameters:
request
-response
-userLoginId
-- Returns:
- Returns "success" if user could be logged in or "error" if there was a problem.
-
checkRequestHeaderLogin
public static String checkRequestHeaderLogin(HttpServletRequest request, HttpServletResponse response) -
checkServletRequestRemoteUserLogin
public static String checkServletRequestRemoteUserLogin(HttpServletRequest request, HttpServletResponse response) -
check509CertLogin
-
checkValidIssuer
protected static boolean checkValidIssuer(Delegator delegator, Map<String, String> x500Map, BigInteger serialNumber) throws GeneralException- Throws:
GeneralException
-
isFlaggedLoggedOut
-
hasApplicationPermission
public static boolean hasApplicationPermission(ComponentConfig.WebappInfo info, Security security, GenericValue userLogin) Returnstrue
if the specified user is authorized to access the specified web application.- Parameters:
info
-security
-userLogin
-- Returns:
true
if the specified user is authorized to access the specified web application
-
hasBasePermission
-
getAppBarWebInfos
public static Collection<ComponentConfig.WebappInfo> getAppBarWebInfos(Security security, GenericValue userLogin, String serverName, String menuName) Returns aCollection
ofWebappInfo
instances that the specified user is authorized to access.- Parameters:
security
-userLogin
-serverName
-menuName
-- Returns:
- A
Collection
WebappInfo
instances that the specified user is authorized to access
-
getUserLoginSession
-
autoChangePassword
-
isUserLoginActive
Return true if userLogin has not been disabled- Parameters:
userLogin
-- Returns:
- boolean
-