com.gisgraphy.service
Class UserSecurityAdvice
java.lang.Object
com.gisgraphy.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 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 String |
ACCESS_DENIED
Default "Access Denied" error message (not i18n-ized). |
Method Summary |
void |
afterReturning(Object returnValue,
Method method,
Object[] args,
Object target)
After returning, grab the user, check if they've been modified and reset
the SecurityContext if they have. |
void |
before(Method method,
Object[] args,
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 String ACCESS_DENIED
- Default "Access Denied" error message (not i18n-ized).
- See Also:
- Constant Field Values
UserSecurityAdvice
public UserSecurityAdvice()
before
public void before(Method method,
Object[] args,
Object target)
throws 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:
Throwable
- thrown when args[0] is null or not a User object
afterReturning
public void afterReturning(Object returnValue,
Method method,
Object[] args,
Object target)
throws 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:
Throwable
- thrown when args[0] is null or not a User object
Copyright © 2012. All Rights Reserved.