Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2003 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.bea.p13n.usermgmt
Class SessionHelper

    java.lang.Object
      |
      +--com.bea.p13n.usermgmt.SessionHelper

public class SessionHelper
extends Object

Field Summary
`static String` | `LOGIN_UID` Constant to indicate user has logged in with a valid user id
`static String` | `PROFILE_WRAPPER` constant to look up the current profile wrapper

Constructor Summary
`SessionHelper()`

Method Summary
`static String` | `getAuthenticatedUserId(HttpServletRequest req)` Get the logged in user's id from the request.
`static boolean` | `getFireLoginEvent(HttpSession session)`
`static ProfileWrapper` | `getProfile(HttpServletRequest req)` Get the current profile from either the session or the request.
`static ProfileWrapper` | `getProfile(HttpServletRequest req, boolean createNew)` Look for a profile in the request, with the option to create a new Session if there is not a current one in the Request object.
`static ProfileWrapper` | `getProfile(HttpSession session)` Get the current profile from the session
`static String` | `getUserId(HttpServletRequest req)` Get the (not neccessarily logged in) user's id from the request.
`static void` | `postCreateUser(HttpServletRequest request, String username, String password, boolean saveAnonymous, boolean fireEvent, boolean login)` Actions to be performed upon user creation (self-registration style).
`static void` | `postLogin(HttpServletRequest request)` Option to fire SessionLoginEvent
`static void` | `putProfileInRequest(HttpServletRequest req, ProfileWrapper profile)` Put a profile in the request.
`static void` | `putProfileInSession(HttpServletRequest req, ProfileWrapper profile)` Put a profile in the session.
`static void` | `putProfileInSession(HttpSession session, ProfileWrapper profile)` Put a profile in the session.
`static ProfileWrapper` | `removeAndReturnProfile(HttpSession session)` Removes profile wrapper references from the session and returns it.
`static void` | `removeProfile(HttpServletRequest req)` Removes profile wrapper references from both the request and the session.
`static void` | `removeProfile(HttpSession session)` Removes profile wrapper references from the session.
`static void` | `setFireLoginEvent(ServletContext sc, boolean doFire)` Look in web.xml to see if we're going to fire SessionLoginEvents upon user login.
`static boolean` | `userIsRegistered(HttpSession session)` Determine whether user is authenticated by presence of attribute in Session

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### PROFILE_WRAPPER

    public static final String PROFILE_WRAPPER

  constant to look up the current profile wrapper

  See Also:
    Constant Field Values

### LOGIN_UID

    public static final String LOGIN_UID

  Constant to indicate user has logged in with a valid user id

  See Also:
    Constant Field Values

Constructor Detail

### SessionHelper

    public SessionHelper()

Method Detail

### getProfile

    public static ProfileWrapper getProfile(HttpServletRequest req)

  Get the current profile from either the session or the request. Looks in the session first, then the request.

### getProfile

    public static ProfileWrapper getProfile(HttpServletRequest req,
                                            boolean createNew)

  Look for a profile in the request, with the option to create a new Session if there is not a current one in the Request object.

### getProfile

    public static ProfileWrapper getProfile(HttpSession session)

  Get the current profile from the session

### removeProfile

    public static void removeProfile(HttpServletRequest req)

  Removes profile wrapper references from both the request and the session.

### removeProfile

    public static void removeProfile(HttpSession session)

  Removes profile wrapper references from the session.

### removeAndReturnProfile

    public static ProfileWrapper removeAndReturnProfile(HttpSession session)

  Removes profile wrapper references from the session and returns it.

  Returns:
    the ProfileWrapper, or null if none was found

### putProfileInSession

    public static void putProfileInSession(HttpServletRequest req,
                                           ProfileWrapper profile)

  Put a profile in the session.

### putProfileInSession

    public static void putProfileInSession(HttpSession session,
                                           ProfileWrapper profile)

  Put a profile in the session.

### putProfileInRequest

    public static void putProfileInRequest(HttpServletRequest req,
                                           ProfileWrapper profile)

  Put a profile in the request.

### getUserId

    public static String getUserId(HttpServletRequest req)

  Get the (not neccessarily logged in) user's id from the request.

  This will check the username of a profile in the request/session first (this will handle tracked anonymous users). If there's no profile or it's fully anonymous, this will check the authenticated user id.

  Parameters:
    `req` - the servlet request.
  Returns:
    the user id, null if cannot be determined.

### getAuthenticatedUserId

    public static String getAuthenticatedUserId(HttpServletRequest req)

  Get the logged in user's id from the request.

  This checks for the user principal on the request.

  Parameters:
    `req` - the servlet request.
  Returns:
    the user id, null if not authenticated.

### postCreateUser

    public static void postCreateUser(HttpServletRequest request,
                                      String username,
                                      String password,
                                      boolean saveAnonymous,
                                      boolean fireEvent,
                                      boolean login)
                               throws LoginException

  Actions to be performed upon user creation (self-registration style). This will authenticate the new user in the request, update the user profile in the session as needed, fire a SessionLoginEvent, then fire a UserRegistrationEvent.

  NOTE that this method always removes the original profile and replaces it with a new one representing the new user, regardless of whether they logged in. That new profile is ProfileType.REGISTERED.

    `LoginException`

### postLogin

    public static void postLogin(HttpServletRequest request)

  Option to fire SessionLoginEvent

### userIsRegistered

    public static boolean userIsRegistered(HttpSession session)

  Determine whether user is authenticated by presence of attribute in Session

### setFireLoginEvent

    public static void setFireLoginEvent(ServletContext sc,
                                         boolean doFire)

  Look in web.xml to see if we're going to fire SessionLoginEvents upon user login. Specified as follows: `PortalServletFilter com.bea.p13n.servlets.PortalServletFilter fireSessionLoginEvent false Option to fire SessionLoginEvent , defaults to true if not set`

### getFireLoginEvent

    public static boolean getFireLoginEvent(HttpSession session)

Overview | Package | Class | Tree | Deprecated | Index | Help
| © 2003 BEA Systems, Inc.
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003 BEA Systems, Inc. All Rights Reserved