Class AuthorizationAdvisorProxyFactory

java.lang.Object
org.springframework.security.authorization.method.AuthorizationAdvisorProxyFactory
All Implemented Interfaces:
Iterable<AuthorizationAdvisor>, org.springframework.aop.framework.AopInfrastructureBean, AuthorizationProxyFactory

public final class AuthorizationAdvisorProxyFactory extends Object implements AuthorizationProxyFactory, Iterable<AuthorizationAdvisor>, org.springframework.aop.framework.AopInfrastructureBean
A proxy factory for applying authorization advice to an arbitrary object.

For example, consider a non-Spring-managed object Foo:

     class Foo {
         @PreAuthorize("hasAuthority('bar:read')")
         String bar() { ... }
     }
 
Use AuthorizationAdvisorProxyFactory to wrap the instance in Spring Security's PreAuthorize method interceptor like so:
     AuthorizationProxyFactory proxyFactory = AuthorizationAdvisorProxyFactory.withDefaults();
     Foo foo = new Foo();
     foo.bar(); // passes
     Foo securedFoo = proxyFactory.proxy(foo);
     securedFoo.bar(); // access denied!
 
Since:
6.3