[jboss-cvs] jboss-seam/src/main/org/jboss/seam/interceptors ...
Shane Bryzak
Shane_Bryzak at symantec.com
Sun Oct 8 20:50:32 EDT 2006
User: sbryzak2
Date: 06/10/08 20:50:32
Added: src/main/org/jboss/seam/interceptors
SecurityInterceptor.java
Log:
Add SecurityInterceptor to component interceptors if component is secured
Revision Changes Path
1.1 date: 2006/10/09 00:50:32; author: sbryzak2; state: Exp;jboss-seam/src/main/org/jboss/seam/interceptors/SecurityInterceptor.java
Index: SecurityInterceptor.java
===================================================================
package org.jboss.seam.interceptors;
import java.lang.reflect.Method;
import javax.interceptor.AroundInvoke;
import javax.interceptor.InvocationContext;
import org.jboss.seam.Component;
import org.jboss.seam.annotations.Interceptor;
import org.jboss.seam.annotations.Secure;
/**
* Provides authorization services for component invocations.
*
* @author Shane Bryzak
*/
@Interceptor(stateless = true,
around = ValidationInterceptor.class,
within = BijectionInterceptor.class)
public class SecurityInterceptor extends AbstractInterceptor
{
public static boolean isComponentSecure(Component component)
{
if (component.getBeanClass().isAnnotationPresent(Secure.class))
return true;
else
{
for (Method m : component.getBeanClass().getDeclaredMethods())
{
if (m.isAnnotationPresent(Secure.class))
return true;
}
}
return false;
}
@AroundInvoke
public Object checkSecurity(InvocationContext invocation)
throws Exception
{
Method method = invocation.getMethod();
/** @todo Authorize the user before invoking the method. For now, just go ahead */
return invocation.proceed();
}
}
More information about the jboss-cvs-commits
mailing list