net.ramapuram.thomas.service
Class UserSecurityAdvice
java.lang.Object
net.ramapuram.thomas.service.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
This advice is responsible for enforcing security and only allowing administrators
to modify users. Users are allowed to modify themselves.
- Author:
- mraible
|
Field Summary |
static java.lang.String |
ACCESS_DENIED
Default "Access Denied" error message (not i18n-ized). |
|
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 |
ACCESS_DENIED
public static final java.lang.String ACCESS_DENIED
- Default "Access Denied" error message (not i18n-ized).
- See Also:
- Constant Field Values
UserSecurityAdvice
public UserSecurityAdvice()
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 executedargs - the arguments to the methodtarget - 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 objectmethod - the name of the method executedargs - the arguments to the methodtarget - the target class
- Throws:
java.lang.Throwable - thrown when args[0] is null or not a User object
Copyright © 2011. All Rights Reserved.