Class AuthorizationManagerBeforeMethodInterceptor
- java.lang.Object
-
- org.springframework.security.authorization.method.AuthorizationManagerBeforeMethodInterceptor
-
- All Implemented Interfaces:
org.aopalliance.aop.Advice
,org.aopalliance.intercept.Interceptor
,org.aopalliance.intercept.MethodInterceptor
,org.springframework.aop.Advisor
,org.springframework.aop.framework.AopInfrastructureBean
,org.springframework.aop.PointcutAdvisor
,org.springframework.core.Ordered
public final class AuthorizationManagerBeforeMethodInterceptor extends java.lang.Object implements org.springframework.core.Ordered, org.aopalliance.intercept.MethodInterceptor, org.springframework.aop.PointcutAdvisor, org.springframework.aop.framework.AopInfrastructureBean
AMethodInterceptor
which uses aAuthorizationManager
to determine if anAuthentication
may invoke the givenMethodInvocation
- Since:
- 5.6
-
-
Constructor Summary
Constructors Constructor Description AuthorizationManagerBeforeMethodInterceptor(org.springframework.aop.Pointcut pointcut, AuthorizationManager<org.aopalliance.intercept.MethodInvocation> authorizationManager)
Creates an instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description org.aopalliance.aop.Advice
getAdvice()
int
getOrder()
org.springframework.aop.Pointcut
getPointcut()
java.lang.Object
invoke(org.aopalliance.intercept.MethodInvocation mi)
Determine if anAuthentication
has access to theMethodInvocation
using the configuredAuthorizationManager
.boolean
isPerInstance()
static AuthorizationManagerBeforeMethodInterceptor
jsr250()
Creates an interceptor for the JSR-250 annotationsstatic AuthorizationManagerBeforeMethodInterceptor
jsr250(Jsr250AuthorizationManager authorizationManager)
Creates an interceptor for the JSR-250 annotationsstatic AuthorizationManagerBeforeMethodInterceptor
preAuthorize()
Creates an interceptor for thePreAuthorize
annotationstatic AuthorizationManagerBeforeMethodInterceptor
preAuthorize(PreAuthorizeAuthorizationManager authorizationManager)
Creates an interceptor for thePreAuthorize
annotationstatic AuthorizationManagerBeforeMethodInterceptor
secured()
Creates an interceptor for theSecured
annotationstatic AuthorizationManagerBeforeMethodInterceptor
secured(SecuredAuthorizationManager authorizationManager)
Creates an interceptor for theSecured
annotationvoid
setOrder(int order)
-
-
-
Constructor Detail
-
AuthorizationManagerBeforeMethodInterceptor
public AuthorizationManagerBeforeMethodInterceptor(org.springframework.aop.Pointcut pointcut, AuthorizationManager<org.aopalliance.intercept.MethodInvocation> authorizationManager)
Creates an instance.- Parameters:
pointcut
- thePointcut
to useauthorizationManager
- theAuthorizationManager
to use
-
-
Method Detail
-
preAuthorize
public static AuthorizationManagerBeforeMethodInterceptor preAuthorize()
Creates an interceptor for thePreAuthorize
annotation- Returns:
- the interceptor
-
preAuthorize
public static AuthorizationManagerBeforeMethodInterceptor preAuthorize(PreAuthorizeAuthorizationManager authorizationManager)
Creates an interceptor for thePreAuthorize
annotation- Parameters:
authorizationManager
- thePreAuthorizeAuthorizationManager
to use- Returns:
- the interceptor
-
secured
public static AuthorizationManagerBeforeMethodInterceptor secured()
Creates an interceptor for theSecured
annotation- Returns:
- the interceptor
-
secured
public static AuthorizationManagerBeforeMethodInterceptor secured(SecuredAuthorizationManager authorizationManager)
Creates an interceptor for theSecured
annotation- Parameters:
authorizationManager
- theSecuredAuthorizationManager
to use- Returns:
- the interceptor
-
jsr250
public static AuthorizationManagerBeforeMethodInterceptor jsr250()
Creates an interceptor for the JSR-250 annotations- Returns:
- the interceptor
-
jsr250
public static AuthorizationManagerBeforeMethodInterceptor jsr250(Jsr250AuthorizationManager authorizationManager)
Creates an interceptor for the JSR-250 annotations- Parameters:
authorizationManager
- theJsr250AuthorizationManager
to use- Returns:
- the interceptor
-
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation mi) throws java.lang.Throwable
Determine if anAuthentication
has access to theMethodInvocation
using the configuredAuthorizationManager
.- Specified by:
invoke
in interfaceorg.aopalliance.intercept.MethodInterceptor
- Parameters:
mi
- theMethodInvocation
to check- Throws:
AccessDeniedException
- if access is not grantedjava.lang.Throwable
-
getOrder
public int getOrder()
- Specified by:
getOrder
in interfaceorg.springframework.core.Ordered
-
setOrder
public void setOrder(int order)
-
getPointcut
public org.springframework.aop.Pointcut getPointcut()
- Specified by:
getPointcut
in interfaceorg.springframework.aop.PointcutAdvisor
-
getAdvice
public org.aopalliance.aop.Advice getAdvice()
- Specified by:
getAdvice
in interfaceorg.springframework.aop.Advisor
-
isPerInstance
public boolean isPerInstance()
- Specified by:
isPerInstance
in interfaceorg.springframework.aop.Advisor
-
-