Example usage for org.springframework.security.access.intercept.aspectj AspectJMethodSecurityInterceptor AspectJMethodSecurityInterceptor

List of usage examples for org.springframework.security.access.intercept.aspectj AspectJMethodSecurityInterceptor AspectJMethodSecurityInterceptor

Introduction

In this page you can find the example usage for org.springframework.security.access.intercept.aspectj AspectJMethodSecurityInterceptor AspectJMethodSecurityInterceptor.

Prototype

AspectJMethodSecurityInterceptor

Source Link

Usage

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

/**
 * Creates the default MethodInterceptor which is a MethodSecurityInterceptor using
 * the following methods to construct it.
 * <ul>//from   w w  w .j  a  va  2s  .  c  om
 * <li>{@link #accessDecisionManager()}</li>
 * <li>{@link #afterInvocationManager()}</li>
 * <li>{@link #authenticationManager()}</li>
 * <li>{@link #runAsManager()}</li>
 *
 * </ul>
 *
 * <p>
 * Subclasses can override this method to provide a different
 * {@link MethodInterceptor}.
 * </p>
 * @param methodSecurityMetadataSource the default {@link MethodSecurityMetadataSource}.
 *
 * @return the {@link MethodInterceptor}.
 */
@Bean
public MethodInterceptor methodSecurityInterceptor(MethodSecurityMetadataSource methodSecurityMetadataSource) {
    this.methodSecurityInterceptor = isAspectJ() ? new AspectJMethodSecurityInterceptor()
            : new MethodSecurityInterceptor();
    methodSecurityInterceptor.setAccessDecisionManager(accessDecisionManager());
    methodSecurityInterceptor.setAfterInvocationManager(afterInvocationManager());
    methodSecurityInterceptor.setSecurityMetadataSource(methodSecurityMetadataSource);
    RunAsManager runAsManager = runAsManager();
    if (runAsManager != null) {
        methodSecurityInterceptor.setRunAsManager(runAsManager);
    }

    return this.methodSecurityInterceptor;
}