Spring Security Framework

org.springframework.security.intercept.method
Class ProtectPointcutPostProcessor

java.lang.Object
  extended by org.springframework.security.intercept.method.ProtectPointcutPostProcessor
All Implemented Interfaces:
BeanPostProcessor

public final class ProtectPointcutPostProcessor
extends Object
implements BeanPostProcessor

Parses AspectJ pointcut expressions, registering methods that match the pointcut with a traditional MapBasedMethodDefinitionSource.

This class provides a convenient way of declaring a list of pointcuts, and then having every method of every bean defined in the Spring application context compared with those pointcuts. Where a match is found, the matching method will be registered with the MapBasedMethodDefinitionSource.

It is very important to understand that only the first pointcut that matches a given method will be taken as authoritative for that method. This is why pointcuts should be provided as a LinkedHashMap, because their order is very important.

Note also that only beans defined in the Spring application context will be examined by this class.

Because this class registers method security metadata with MapBasedMethodDefinitionSource, normal Spring Security capabilities such as MethodDefinitionSourceAdvisor can be used. It does not matter the fact the method metadata was originally obtained from an AspectJ pointcut expression evaluation.

Since:
2.0
Author:
Ben Alex

Constructor Summary
ProtectPointcutPostProcessor(MapBasedMethodDefinitionSource mapBasedMethodDefinitionSource)
           
 
Method Summary
 Object postProcessAfterInitialization(Object bean, String beanName)
           
 Object postProcessBeforeInitialization(Object bean, String beanName)
           
 void setPointcutMap(Map map)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ProtectPointcutPostProcessor

public ProtectPointcutPostProcessor(MapBasedMethodDefinitionSource mapBasedMethodDefinitionSource)
Method Detail

postProcessAfterInitialization

public Object postProcessAfterInitialization(Object bean,
                                             String beanName)
                                      throws BeansException
Specified by:
postProcessAfterInitialization in interface BeanPostProcessor
Throws:
BeansException

postProcessBeforeInitialization

public Object postProcessBeforeInitialization(Object bean,
                                              String beanName)
                                       throws BeansException
Specified by:
postProcessBeforeInitialization in interface BeanPostProcessor
Throws:
BeansException

setPointcutMap

public void setPointcutMap(Map map)

Spring Security Framework

Copyright © 2004-2010 SpringSource, Inc. All Rights Reserved.