Class LoginWorker


  • public final class LoginWorker
    extends java.lang.Object
    Common Workers
    • Constructor Detail

      • LoginWorker

        protected LoginWorker()
    • Method Detail

      • makeLoginUrl

        public static StringUtil.StringWrapper makeLoginUrl​(javax.servlet.jsp.PageContext pageContext,
                                                            java.lang.String requestName)
      • setLoggedOut

        public static void setLoggedOut​(java.lang.String userLoginId,
                                        Delegator delegator)
      • checkImpersonationInProcess

        public static GenericValue checkImpersonationInProcess​(HttpServletRequest request,
                                                               HttpServletResponse response)
        Return the active GenericValue 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
      • extensionConnectLogin

        public static java.lang.String extensionConnectLogin​(HttpServletRequest request,
                                                             HttpServletResponse response)
        This WebEvent allows for java 'services' to hook into the login path. This method loads all instances of LoginCheck, and calls the LoginCheck.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

        public static java.lang.String checkLogin​(HttpServletRequest request,
                                                  HttpServletResponse response)
        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

        public static java.lang.String login​(HttpServletRequest request,
                                             HttpServletResponse response)
        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

        public static java.lang.String impersonateLogin​(HttpServletRequest request,
                                                        HttpServletResponse response)
        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

        public static java.lang.String depersonateLogin​(HttpServletRequest request,
                                                        HttpServletResponse response)
        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.
      • logout

        public static java.lang.String logout​(HttpServletRequest request,
                                              HttpServletResponse response)
        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.
      • getAutoLoginCookieName

        protected static java.lang.String getAutoLoginCookieName​(HttpServletRequest request)
      • getSecuredLoginIdCookieName

        protected static java.lang.String getSecuredLoginIdCookieName​(HttpServletRequest request)
      • getAutoUserLoginId

        public static java.lang.String getAutoUserLoginId​(HttpServletRequest request)
      • getSecuredUserLoginId

        public static java.lang.String getSecuredUserLoginId​(HttpServletRequest request)
      • loginUserWithUserLoginId

        public static java.lang.String loginUserWithUserLoginId​(HttpServletRequest request,
                                                                HttpServletResponse response,
                                                                java.lang.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.
      • checkValidIssuer

        protected static boolean checkValidIssuer​(Delegator delegator,
                                                  java.util.Map<java.lang.String,​java.lang.String> x500Map,
                                                  java.math.BigInteger serialNumber)
                                           throws GeneralException
        Throws:
        GeneralException
      • isFlaggedLoggedOut

        public static boolean isFlaggedLoggedOut​(GenericValue userLogin,
                                                 Delegator delegator)
      • hasApplicationPermission

        public static boolean hasApplicationPermission​(ComponentConfig.WebappInfo info,
                                                       Security security,
                                                       GenericValue userLogin)
        Returns true 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
      • getAppBarWebInfos

        public static java.util.Collection<ComponentConfig.WebappInfo> getAppBarWebInfos​(Security security,
                                                                                         GenericValue userLogin,
                                                                                         java.lang.String serverName,
                                                                                         java.lang.String menuName)
        Returns a Collection of WebappInfo 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

        public static java.util.Map<java.lang.String,​java.lang.Object> getUserLoginSession​(GenericValue userLogin)
      • isUserLoginActive

        public static boolean isUserLoginActive​(GenericValue userLogin)
        Return true if userLogin has not been disabled
        Parameters:
        userLogin -
        Returns:
        boolean