Expresso 5-6

com.jcorporate.expresso.ext.taglib
Class RestrictAccessTag

java.lang.Object
  extended byjavax.servlet.jsp.tagext.TagSupport
      extended bycom.jcorporate.expresso.ext.taglib.RestrictAccessTag
All Implemented Interfaces:
IterationTag, Serializable, Tag

public class RestrictAccessTag
extends TagSupport

Restrict Access Tag - To easily restrict JSP page access.

This class provides an easy way to restrict access to particular pages. Attributes: allowedUsers: A comma delimited list of user names that are allowed to access this page.

allowedGroups: A comma delimited list of groups that are allowed access to this page

If neither allowedUsers or allowedGroups is set, then anybody that's logged in, will be allowed to access the page.

Example Usage (Allows admin group to this page):

<%@ taglib uri="expresso.tld" prefix"expresso" %>

<expresso:RestrictAccess allowedGroups="admin" />

Author:
Michael Rimov
See Also:
Serialized Form

Field Summary
 
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
RestrictAccessTag()
           
 
Method Summary
protected  void denyAccess()
           
 int doEndTag()
          Standard doEndTag.
 int doStartTag()
          Do nothing until end tag.
 void setAllowedGroups(String groupList)
          Adds a comma delimited list of allowed groups to the allowedGroups Hashtable
 void setAllowedUsers(String userList)
          Adds a comma delimited list of allowed users to the allowedUsers Hashtable.
 void setDenyURL(String url)
          Sets a URL to forward to if access is denied
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, findAncestorWithClass, getId, getParent, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RestrictAccessTag

public RestrictAccessTag()
Method Detail

setAllowedUsers

public void setAllowedUsers(String userList)
Adds a comma delimited list of allowed users to the allowedUsers Hashtable.

Parameters:
userList - the allowed users for this user

setAllowedGroups

public void setAllowedGroups(String groupList)
Adds a comma delimited list of allowed groups to the allowedGroups Hashtable

Parameters:
groupList - a comma delimited list of groups allowed to access this page

setDenyURL

public void setDenyURL(String url)
Sets a URL to forward to if access is denied

Parameters:
url - the URL to forward to if access to this page is denied

doEndTag

public int doEndTag()
             throws JspTagException
Standard doEndTag. This is the main processing. Will check to see if the current user matches the appropriate userlist of grouplist

Returns:
int
Throws:
JspTagException

doStartTag

public int doStartTag()
               throws JspTagException
Do nothing until end tag.

Returns:
int
Throws:
JspTagException - The exception description.

denyAccess

protected void denyAccess()
                   throws JspTagException
Throws:
JspTagException

Expresso 5-6

Please see www.jcorporate.com for information about new Expresso releases.