[jboss-cvs] jboss-seam/src/main/org/jboss/seam/security/filter ...
Shane Bryzak
Shane_Bryzak at symantec.com
Wed Jan 24 17:46:54 EST 2007
User: sbryzak2
Date: 07/01/24 17:46:54
Modified: src/main/org/jboss/seam/security/filter
SeamSecurityFilter.java
Log:
only proceed down the chain if not redirecting
Revision Changes Path
1.18 +77 -74 jboss-seam/src/main/org/jboss/seam/security/filter/SeamSecurityFilter.java
(In the diff below, changes in quantity of whitespace are not shown.)
Index: SeamSecurityFilter.java
===================================================================
RCS file: /cvsroot/jboss/jboss-seam/src/main/org/jboss/seam/security/filter/SeamSecurityFilter.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -b -r1.17 -r1.18
--- SeamSecurityFilter.java 2 Jan 2007 07:42:57 -0000 1.17
+++ SeamSecurityFilter.java 24 Jan 2007 22:46:54 -0000 1.18
@@ -33,8 +33,7 @@
private ServletContext servletContext;
- public void init(FilterConfig filterConfig)
- throws ServletException
+ public void init(FilterConfig filterConfig) throws ServletException
{
servletContext = filterConfig.getServletContext();
WebApplicationContext ctx = new WebApplicationContext(servletContext);
@@ -49,28 +48,31 @@
* @throws IOException
* @throws ServletException
*/
- public void doFilter(ServletRequest request, ServletResponse response,
- FilterChain chain)
+ public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException
{
HttpServletRequest hRequest = (HttpServletRequest) request;
HttpServletResponse hResponse = (HttpServletResponse) response;
- Context sessionContext = new WebSessionContext(
- ContextAdaptor.getSession(hRequest.getSession()));
+ Context sessionContext = new WebSessionContext(ContextAdaptor.getSession(hRequest
+ .getSession()));
- Identity ident = (Identity)sessionContext.get(Seam.getComponentName(Identity.class));
+ Identity ident = (Identity) sessionContext.get(Seam.getComponentName(Identity.class));
if (!checkSecurityConstraints(hRequest.getServletPath(), hRequest.getMethod(), ident))
- hResponse.sendRedirect(String.format("%s%s", hRequest.getContextPath(),
- config.getSecurityErrorPage()));
-
+ {
+ hResponse.sendRedirect(String.format("%s%s", hRequest.getContextPath(), config
+ .getSecurityErrorPage()));
+ }
+ else
+ {
chain.doFilter(request, response);
}
+ }
/**
- * Performs a security check for a specified uri and method, for the specified
- * Identity
+ * Performs a security check for a specified uri and method, for the
+ * specified Identity
*
* @param uri String
* @param method String
@@ -83,8 +85,7 @@
{
if (c.included(uri, method))
{
- if (ident == null || !userHasRole(ident, c.getAuthConstraint().getRoles()))
- return false;
+ if (ident == null || !userHasRole(ident, c.getAuthConstraint().getRoles())) return false;
}
}
@@ -92,7 +93,8 @@
}
/**
- * Returns true if the specified Identity has any one of a number of specified roles.
+ * Returns true if the specified Identity has any one of a number of
+ * specified roles.
*
* @param ident Identity
* @param roles String[]
@@ -102,12 +104,13 @@
{
for (String role : roles)
{
- if (ident.isUserInRole(role))
- return true;
+ if (ident.isUserInRole(role)) return true;
}
return false;
}
- public void destroy() {}
+ public void destroy()
+ {
+ }
}
More information about the jboss-cvs-commits
mailing list