com.arsdigita.acs
Class Security

java.lang.Object
  |
  +--com.arsdigita.acs.Security

public class Security
extends Object

Utility procedures for verifying user log-in information.

See Also:
UserInfo

Constructor Summary
Security()
           
 
Method Summary
static UserInfo getVerifiedUserInfo(HttpServletRequest req, HttpServletResponse resp)
          Same as getVerifiedUserInfo(req, resp, true)
static UserInfo getVerifiedUserInfo(HttpServletRequest req, HttpServletResponse resp, boolean redirect)
          Checks the current HttpSession for a set UserInfo object.
static UserInfo getVerifiedUserInfo(PageContext pc)
          Same as getVerifiedUserInfo(pc, true).
static UserInfo getVerifiedUserInfo(PageContext pc, boolean redirect)
          Checks the current HttpSession for a set UserInfo object.
static void loginUser(PageContext pc, Integer userId, boolean forever)
           
static void logoutUser(PageContext pc)
          Logs out the user.
static void redirectForRegistration(HttpServletRequest request, HttpServletResponse response)
          Redirects to /register.
static void redirectForRegistration(PageContext pc)
          Redirects to /register.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Security

public Security()
Method Detail

getVerifiedUserInfo

public static UserInfo getVerifiedUserInfo(PageContext pc,
                                           boolean redirect)
                                    throws IOException
Checks the current HttpSession for a set UserInfo object. This object will be non-null if and only if the user has not already logged in. Redirects to /acs/register if the user is not yet logged in and redirect is true. Otherwise returns null. Must be called from a JSP tag class.
Parameters:
pc - The current page context
redirect - If true, redirects to the registration page if the user is not yet logged in.
Returns:
A UserInfo object for the logged-in user, or null if the user is not yet logged in.

getVerifiedUserInfo

public static UserInfo getVerifiedUserInfo(PageContext pc)
                                    throws IOException
Same as getVerifiedUserInfo(pc, true).

redirectForRegistration

public static final void redirectForRegistration(PageContext pc)
                                          throws IOException
Redirects to /register.

redirectForRegistration

public static final void redirectForRegistration(HttpServletRequest request,
                                                 HttpServletResponse response)
                                          throws IOException
Redirects to /register.

logoutUser

public static void logoutUser(PageContext pc)
Logs out the user. Expires the ad_user_login cookie and takes the user_info attribute out of the current HttpSession.

loginUser

public static void loginUser(PageContext pc,
                             Integer userId,
                             boolean forever)
                      throws SQLException,
                             ACSException

getVerifiedUserInfo

public static UserInfo getVerifiedUserInfo(HttpServletRequest req,
                                           HttpServletResponse resp,
                                           boolean redirect)
                                    throws IOException
Checks the current HttpSession for a set UserInfo object. This object will be non-null if and only if the user has not already logged in. Redirects to /register if the user is not yet logged in and redirect is true.
Parameters:
req - The current servlet request
resp - The curent servlet response
redirect - If false, return null for not-logged-in user; if true, redirect for registration.
Returns:
A UserInfo object for the logged-in user, or null if the user is not yet logged in.

getVerifiedUserInfo

public static UserInfo getVerifiedUserInfo(HttpServletRequest req,
                                           HttpServletResponse resp)
                                    throws IOException
Same as getVerifiedUserInfo(req, resp, true)