SecurityAnnotationBeanPostProcessor

public class SecurityAnnotationBeanPostProcessor implements BeanPostProcessor

A BeanPostProcessor used by Motech to load permissions from modules. Given a module context, it looks for PreAuthorize and PostAuthorize annotations. These annotations are then parsed using an ExpressionParser. The permission names are deduced from hasRole and hasAnyRole in the annotation value. The names of permissions are then saved using the MotechPermissionService. The bundle name used to construct the permission is retrieved from the application context.

Constructors

SecurityAnnotationBeanPostProcessor

public SecurityAnnotationBeanPostProcessor(MotechPermissionService permissionService)

Methods

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean, String beanName)

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean, String beanName)

processAnnotations

public void processAnnotations(ApplicationContext applicationContext)