|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
com.bea.p13n.usermgmt.SessionHelper
public class SessionHelper
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 void |
bindProfile(javax.servlet.http.HttpServletRequest request, ProfileWrapper profile) Bind user profile to HTTP session. |
static String |
getAuthenticatedUserId(javax.servlet.http.HttpServletRequest req) Get the logged in user's id from the request. |
static boolean |
getFireLoginEvent(javax.servlet.http.HttpSession session) |
static ProfileWrapper |
getProfile(javax.servlet.http.HttpServletRequest req) Get the current profile from either the session or the request. |
static ProfileWrapper |
getProfile(javax.servlet.http.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(javax.servlet.http.HttpSession session) Get the current profile from the session |
static javax.servlet.http.HttpSession |
getSession(javax.servlet.http.HttpServletRequest request) This method attempts to return a reference to the current session, and will attempt to create a HttpSession if none exists (respecting the optional descriptor configuraton max-in-memory-sessions). |
static javax.servlet.http.HttpSession |
getSession(javax.servlet.http.HttpServletRequest request, boolean createNew) This method attempts to return a reference to the current session, and will attempt to create a HttpSession if needed, if createNew is true (respecting the optional descriptor configuraton max-in-memory-sessions). |
static String |
getUserId(javax.servlet.http.HttpServletRequest req) Get the (not neccessarily logged in) user's id from the request. |
static void |
postCreateUser(javax.servlet.http.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(javax.servlet.http.HttpServletRequest request) Option to fire SessionLoginEvent |
static void |
putProfileInRequest(javax.servlet.http.HttpServletRequest req, ProfileWrapper profile) Put a profile in the request. |
static void |
putProfileInSession(javax.servlet.http.HttpServletRequest req, ProfileWrapper profile) Put a profile in the session. |
static void |
putProfileInSession(javax.servlet.http.HttpSession session, ProfileWrapper profile) Put a profile in the session. |
static ProfileWrapper |
removeAndReturnProfile(javax.servlet.http.HttpSession session) Removes profile wrapper references from the session and returns it. |
static void |
removeProfile(javax.servlet.http.HttpServletRequest req) Removes profile wrapper references from both the request and the session. |
static void |
removeProfile(javax.servlet.http.HttpSession session) Removes profile wrapper references from the session. |
static void |
setFireLoginEvent(javax.servlet.ServletContext sc, boolean doFire) Look in web.xml to see if we're going to fire SessionLoginEvents upon user login. |
static boolean |
userIsRegistered(javax.servlet.http.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 |
---|
public static final String PROFILE_WRAPPER
public static final String LOGIN_UID
Constructor Detail |
---|
public SessionHelper()
Method Detail |
---|
public static ProfileWrapper getProfile(javax.servlet.http.HttpServletRequest req)
public static ProfileWrapper getProfile(javax.servlet.http.HttpServletRequest req, boolean createNew)
public static ProfileWrapper getProfile(javax.servlet.http.HttpSession session)
public static void removeProfile(javax.servlet.http.HttpServletRequest req)
public static void removeProfile(javax.servlet.http.HttpSession session)
public static ProfileWrapper removeAndReturnProfile(javax.servlet.http.HttpSession session)
public static void putProfileInSession(javax.servlet.http.HttpServletRequest req, ProfileWrapper profile)
public static void putProfileInSession(javax.servlet.http.HttpSession session, ProfileWrapper profile)
public static void putProfileInRequest(javax.servlet.http.HttpServletRequest req, ProfileWrapper profile)
public static void bindProfile(javax.servlet.http.HttpServletRequest request, ProfileWrapper profile)
createSession
parameter configured to false
of PortalServletFilter
in web.xml, or session exceed limits configured by weblogic.xml, this method will not create session. The user profile will bind to HTTP reqeust instead.request
- a HTTP request used to lookup HTTP session or bind profileprofile
- user profile objectpublic static String getUserId(javax.servlet.http.HttpServletRequest req)
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.
req
- the servlet request.public static String getAuthenticatedUserId(javax.servlet.http.HttpServletRequest req)
This checks for the user principal on the request.
req
- the servlet request.public static void postCreateUser(javax.servlet.http.HttpServletRequest request, String username, String password, boolean saveAnonymous, boolean fireEvent, boolean login) throws LoginException
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
public static void postLogin(javax.servlet.http.HttpServletRequest request)
public static boolean userIsRegistered(javax.servlet.http.HttpSession session)
public static void setFireLoginEvent(javax.servlet.ServletContext sc, boolean doFire)
<filter> <filter-name> PortalServletFilter </filter-name> <filter-class> com.bea.p13n.servlets.PortalServletFilter </filter-class> <init-param> <param-name>fireSessionLoginEvent</param-name> <param-value>false</param-value> <description> Option to fire SessionLoginEvent , defaults to true if not set</description> </init-param> </filter>
public static boolean getFireLoginEvent(javax.servlet.http.HttpSession session)
public static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request)
HttpSession
if none exists (respecting the optional descriptor configuraton max-in-memory-sessions). If a configured maximum number of session already exists, a null value is returned.request
- The current HttpServletRequest
public static javax.servlet.http.HttpSession getSession(javax.servlet.http.HttpServletRequest request, boolean createNew)
HttpSession
if needed, if createNew is true (respecting the optional descriptor configuraton max-in-memory-sessions). If a configured maximum number of session already exists, a null value is returned.request
- The current HttpServletRequest
createNew
- Will attempt to create a new session, if none exists
|
Oracle Fusion Middleware Java API for Oracle WebLogic Portal 10g Release 3 (10.3.2) E14255-01 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 2010, Oracle. All rights reserved.