SecurityAnnotationBeanPostProcessor¶
-
public class
SecurityAnnotationBeanPostProcessorimplements BeanPostProcessor¶ A
BeanPostProcessorused by Motech to load permissions from modules. Given a module context, it looks forPreAuthorizeandPostAuthorizeannotations. These annotations are then parsed using anExpressionParser. The permission names are deduced fromhasRoleandhasAnyRolein the annotation value. The names of permissions are then saved using theMotechPermissionService. 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)¶ Searches for
org.springframework.security.access.prepost.PreAuthorizeandorg.springframework.security.access.prepost.PostAuthorizeannotations representing permissions and parses them. Parsed annotations are used to find permissions. After that those permissions are added toorg.motechproject.security.service.MotechPermissionServiceParameters: - bean – to be processed
- beanName – name of the bean
Returns: processed bean
postProcessBeforeInitialization¶
processAnnotations¶
-
public void
processAnnotations(ApplicationContext applicationContext)¶ Processes security annotations from bundles using
postProcessAfterInitialization(Object,String)methodParameters: - applicationContext – bundle context used to look for annotations