Search in sources :

Example 1 with AfterInvocationProvider

use of org.springframework.security.access.AfterInvocationProvider in project spring-security by spring-projects.

the class GlobalMethodSecurityConfiguration method afterInvocationManager.

/**
	 * Provide a custom {@link AfterInvocationManager} for the default implementation of
	 * {@link #methodSecurityInterceptor()}. The default is null if pre post is not
	 * enabled. Otherwise, it returns a {@link AfterInvocationProviderManager}.
	 *
	 * <p>
	 * Subclasses should override this method to provide a custom
	 * {@link AfterInvocationManager}
	 * </p>
	 *
	 * @return
	 */
protected AfterInvocationManager afterInvocationManager() {
    if (prePostEnabled()) {
        AfterInvocationProviderManager invocationProviderManager = new AfterInvocationProviderManager();
        ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice(getExpressionHandler());
        PostInvocationAdviceProvider postInvocationAdviceProvider = new PostInvocationAdviceProvider(postAdvice);
        List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<AfterInvocationProvider>();
        afterInvocationProviders.add(postInvocationAdviceProvider);
        invocationProviderManager.setProviders(afterInvocationProviders);
        return invocationProviderManager;
    }
    return null;
}
Also used : PostInvocationAdviceProvider(org.springframework.security.access.prepost.PostInvocationAdviceProvider) AfterInvocationProviderManager(org.springframework.security.access.intercept.AfterInvocationProviderManager) ArrayList(java.util.ArrayList) ExpressionBasedPostInvocationAdvice(org.springframework.security.access.expression.method.ExpressionBasedPostInvocationAdvice) AfterInvocationProvider(org.springframework.security.access.AfterInvocationProvider)

Aggregations

ArrayList (java.util.ArrayList)1 AfterInvocationProvider (org.springframework.security.access.AfterInvocationProvider)1 ExpressionBasedPostInvocationAdvice (org.springframework.security.access.expression.method.ExpressionBasedPostInvocationAdvice)1 AfterInvocationProviderManager (org.springframework.security.access.intercept.AfterInvocationProviderManager)1 PostInvocationAdviceProvider (org.springframework.security.access.prepost.PostInvocationAdviceProvider)1