Example usage for org.springframework.security.access.prepost PostInvocationAdviceProvider PostInvocationAdviceProvider

List of usage examples for org.springframework.security.access.prepost PostInvocationAdviceProvider PostInvocationAdviceProvider

Introduction

In this page you can find the example usage for org.springframework.security.access.prepost PostInvocationAdviceProvider PostInvocationAdviceProvider.

Prototype

public PostInvocationAdviceProvider(PostInvocationAuthorizationAdvice postAdvice) 

Source Link

Usage

From source file:org.springframework.security.config.annotation.method.configuration.GlobalMethodSecurityConfiguration.java

/**
 * Provide a custom {@link AfterInvocationManager} for the default implementation of
 * {@link #methodSecurityInterceptor(MethodSecurityMetadataSource)}. The default is null
 * if pre post is not enabled. Otherwise, it returns a {@link AfterInvocationProviderManager}.
 *
 * <p>/*from www .  j  av a  2 s .  c o m*/
 * Subclasses should override this method to provide a custom
 * {@link AfterInvocationManager}
 * </p>
 *
 * @return the {@link AfterInvocationManager} to use
 */
protected AfterInvocationManager afterInvocationManager() {
    if (prePostEnabled()) {
        AfterInvocationProviderManager invocationProviderManager = new AfterInvocationProviderManager();
        ExpressionBasedPostInvocationAdvice postAdvice = new ExpressionBasedPostInvocationAdvice(
                getExpressionHandler());
        PostInvocationAdviceProvider postInvocationAdviceProvider = new PostInvocationAdviceProvider(
                postAdvice);
        List<AfterInvocationProvider> afterInvocationProviders = new ArrayList<>();
        afterInvocationProviders.add(postInvocationAdviceProvider);
        invocationProviderManager.setProviders(afterInvocationProviders);
        return invocationProviderManager;
    }
    return null;
}