org.appfuse.webapp
Class UserSecurityAdvice

java.lang.Object
  extended by org.appfuse.webapp.UserSecurityAdvice
All Implemented Interfaces:
org.aopalliance.aop.Advice, org.springframework.aop.AfterAdvice, org.springframework.aop.AfterReturningAdvice, org.springframework.aop.BeforeAdvice, org.springframework.aop.MethodBeforeAdvice

public class UserSecurityAdvice
extends java.lang.Object
implements org.springframework.aop.MethodBeforeAdvice, org.springframework.aop.AfterReturningAdvice

Override UserSecurityAdvice from appfuse-service in order to allow anyone to update a user's information.

Author:
mraible

Constructor Summary
UserSecurityAdvice()
           
 
Method Summary
 void afterReturning(java.lang.Object returnValue, java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object target)
          After returning, grab the user, check if they've been modified and reset the SecurityContext if they have.
 void before(java.lang.reflect.Method method, java.lang.Object[] args, java.lang.Object target)
          Method to enforce security and only allow administrators to modify users.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UserSecurityAdvice

public UserSecurityAdvice()
Method Detail

before

public void before(java.lang.reflect.Method method,
                   java.lang.Object[] args,
                   java.lang.Object target)
            throws java.lang.Throwable
Method to enforce security and only allow administrators to modify users. Regular users are allowed to modify themselves.

Specified by:
before in interface org.springframework.aop.MethodBeforeAdvice
Parameters:
method - the name of the method executed
args - the arguments to the method
target - the target class
Throws:
java.lang.Throwable - thrown when args[0] is null or not a User object

afterReturning

public void afterReturning(java.lang.Object returnValue,
                           java.lang.reflect.Method method,
                           java.lang.Object[] args,
                           java.lang.Object target)
                    throws java.lang.Throwable
After returning, grab the user, check if they've been modified and reset the SecurityContext if they have.

Specified by:
afterReturning in interface org.springframework.aop.AfterReturningAdvice
Parameters:
returnValue - the user object
method - the name of the method executed
args - the arguments to the method
target - the target class
Throws:
java.lang.Throwable - thrown when args[0] is null or not a User object


Copyright © 2011. All Rights Reserved.