Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## 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 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).

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`

Field Detail

### ACCESS_DENIED

    public static final java.lang.String ACCESS_DENIED

  Default "Access Denied" error message (not i18n-ized).

  See Also:
    Constant Field Values

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

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009. All Rights Reserved.