|
|||||||||
| Home >> All >> com >> RuntimeCollective >> content >> [ tag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
com.RuntimeCollective.content.tag
Class EditorCheckLogonTag

java.lang.Objectjavax.servlet.jsp.tagext.TagSupport
com.RuntimeCollective.webapps.tag.CheckLogonTag
com.RuntimeCollective.content.tag.EditorCheckLogonTag
- All Implemented Interfaces:
- javax.servlet.jsp.tagext.IterationTag, javax.servlet.jsp.tagext.JspTag, java.io.Serializable, javax.servlet.jsp.tagext.Tag
- public class EditorCheckLogonTag
- extends com.RuntimeCollective.webapps.tag.CheckLogonTag
Check for a valid User logged on in the current session under the key RuntimeParameters.get("logonUserKey"). If there is no
such user, check for a cookie called "LoginCookie.COOKIE_NAME"; the random-key contained in this cookie will reference rs_user, to give the userId. If no such cookie exists, forward control to the logon page.
This class has some logic which could be moved to CheckLogonTag
Important: This tag must be placed on a jsp page before anything is written to the response. It's safest to always put it at the top.
If the user is found from a cookie, a new Session is recorded by calling Session.logUserIn.
This tag takes some optional parameters:
page - the page to go to if the user is not logged in (defaults to /logon.jsp)
role - if set then the tag will only allow users in if they are logged in, and have this role.
You may seperate roles with commas e.g. "0,1,2" - this will allow users in if they have ANY of the specified roles.
isAdmin - will only validate users if they are administrators.
isEditor - will only validate users if they are content editors (or administrators).
hasSession - will only validate users who have an active webapps Session in their HttpSession.
For example, inserting
<%@ taglib uri="/WEB-INF/runtime-struts.tld" prefix="rs" %> into a jsp page will check that the user is logged in, with role 0, and if not will forward them to the home page.
<rs:checkLogon role="0" page="home.jsp"/>
The HasSession bit of functionality should be moved to webapps.tag.CheckLogonTag once it has been tested out.
- Version:
- $Id: EditorCheckLogonTag.java,v 1.8 2003/09/30 15:12:47 joe Exp $
| Field Summary | |
protected boolean |
HasSession
Check whether the User has an active Webapps Session set in his HttpSession |
protected boolean |
isAdmin
Check if the user is a staff administrator. |
protected boolean |
isEditor
Check if the user is a content editor |
protected java.lang.String |
logonPage
The page to which we should forward for the user to log on. |
| Fields inherited from class com.RuntimeCollective.webapps.tag.CheckLogonTag |
cookie, LIST_GROUP_NAMES_KEY, name, page, role |
| Fields inherited from class javax.servlet.jsp.tagext.TagSupport |
id, pageContext |
| Fields inherited from interface javax.servlet.jsp.tagext.IterationTag |
EVAL_BODY_AGAIN |
| Fields inherited from interface javax.servlet.jsp.tagext.Tag |
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE |
| Constructor Summary | |
EditorCheckLogonTag()
|
|
| Method Summary | |
boolean |
checkValid(com.RuntimeCollective.webapps.bean.User user)
In addition to executing CheckLogonTag's getUser method, this also
checks for isAdmin, isEditor roles. |
int |
doEndTag()
Override the super method such as to call a NON STATIC method for getUser. |
static void |
foundUserFromCookie(com.RuntimeCollective.webapps.bean.User user,
javax.servlet.http.HttpServletRequest request)
This method is called when a user is found from a cookie. |
boolean |
getHasSession()
Get whether to check the Session |
boolean |
getIsAdmin()
Get whether to check if the user is a staff administrator. |
boolean |
getIsEditor()
Get whether to check if the user is a content editor |
java.lang.String |
getPage()
Return the forward page. |
com.RuntimeCollective.webapps.bean.User |
getUserNS(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpSession session)
This is currently a duplicate of CheckLogonTag's method, but as it's static, I can't inherit. |
boolean |
hasSession()
Get whether to check the Session |
boolean |
isAdmin()
Get whether to check if the user is a staff administrator. |
boolean |
isEditor()
Get whether to check if the user is a staff member. |
void |
setHasSession(boolean hasSession)
Set whether to check the Session. |
void |
setIsAdmin(boolean isAdmin)
Set to check if the user is a staff administrator. |
void |
setIsEditor(boolean isEditor)
Set to check if the user is a content editor |
void |
setPage(java.lang.String page)
Set the forward page. |
| Methods inherited from class com.RuntimeCollective.webapps.tag.CheckLogonTag |
checkRole, doStartTag, forwardControl, foundUserFromAuthToken, getGroup, getGroups, getGroupType, getLoggedOnUser, getRole, getUser, putReturnURLOnSession, release, removeUserFromSession, setGroup, setGroups, setGroupType, setRole |
| Methods inherited from class javax.servlet.jsp.tagext.TagSupport |
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, removeValue, setId, setPageContext, setParent, setValue |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
logonPage
protected java.lang.String logonPage
- The page to which we should forward for the user to log on.
isAdmin
protected boolean isAdmin
- Check if the user is a staff administrator.
isEditor
protected boolean isEditor
- Check if the user is a content editor
HasSession
protected boolean HasSession
- Check whether the User has an active Webapps Session set in his HttpSession
| Constructor Detail |
EditorCheckLogonTag
public EditorCheckLogonTag()
| Method Detail |
getPage
public java.lang.String getPage()
- Return the forward page.
setPage
public void setPage(java.lang.String page)
- Set the forward page.
getIsAdmin
public boolean getIsAdmin()
- Get whether to check if the user is a staff administrator.
isAdmin
public boolean isAdmin()
- Get whether to check if the user is a staff administrator.
setIsAdmin
public void setIsAdmin(boolean isAdmin)
- Set to check if the user is a staff administrator.
getIsEditor
public boolean getIsEditor()
- Get whether to check if the user is a content editor
isEditor
public boolean isEditor()
- Get whether to check if the user is a staff member.
setIsEditor
public void setIsEditor(boolean isEditor)
- Set to check if the user is a content editor
hasSession
public boolean hasSession()
- Get whether to check the Session
getHasSession
public boolean getHasSession()
- Get whether to check the Session
setHasSession
public void setHasSession(boolean hasSession)
- Set whether to check the Session.
doEndTag
public int doEndTag()
throws javax.servlet.jsp.JspException
- Override the super method such as to call a NON STATIC method for getUser.
getUserNS
public com.RuntimeCollective.webapps.bean.User getUserNS(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpSession session) throws javax.servlet.jsp.JspException
- This is currently a duplicate of CheckLogonTag's method, but as it's static, I can't inherit.
See ticket #2892
And it's actually NOT STATIC anymore for this tag.
checkValid
public boolean checkValid(com.RuntimeCollective.webapps.bean.User user) throws javax.servlet.jsp.JspException
- In addition to executing CheckLogonTag's
getUsermethod, this also checks for isAdmin, isEditor roles.It also disables caching, if isAdmin or isEditor is true, on the assumption that these will be frequently-changing admin pages.
foundUserFromCookie
public static void foundUserFromCookie(com.RuntimeCollective.webapps.bean.User user, javax.servlet.http.HttpServletRequest request)
- This method is called when a user is found from a cookie.
It calls
Session.logUserIn
|
|||||||||
| Home >> All >> com >> RuntimeCollective >> content >> [ tag overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC