Class AuthorizationManagerAfterMethodInterceptor
- java.lang.Object
-
- org.springframework.security.authorization.method.AuthorizationManagerAfterMethodInterceptor
-
- 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 AuthorizationManagerAfterMethodInterceptor extends java.lang.Object implements org.springframework.core.Ordered, org.aopalliance.intercept.MethodInterceptor, org.springframework.aop.PointcutAdvisor, org.springframework.aop.framework.AopInfrastructureBean
AMethodInterceptor
which can determine if anAuthentication
has access to the result of anMethodInvocation
using anAuthorizationManager
- Since:
- 5.6
-
-
Constructor Summary
Constructors Constructor Description AuthorizationManagerAfterMethodInterceptor(org.springframework.aop.Pointcut pointcut, AuthorizationManager<MethodInvocationResult> 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)
boolean
isPerInstance()
static AuthorizationManagerAfterMethodInterceptor
postAuthorize()
Creates an interceptor for thePostAuthorize
annotationstatic AuthorizationManagerAfterMethodInterceptor
postAuthorize(PostAuthorizeAuthorizationManager authorizationManager)
Creates an interceptor for thePostAuthorize
annotationvoid
setAuthorizationEventPublisher(AuthorizationEventPublisher eventPublisher)
Use thisAuthorizationEventPublisher
to publish theAuthorizationManager
result.void
setOrder(int order)
void
setSecurityContextHolderStrategy(SecurityContextHolderStrategy strategy)
Sets theSecurityContextHolderStrategy
to use.
-
-
-
Constructor Detail
-
AuthorizationManagerAfterMethodInterceptor
public AuthorizationManagerAfterMethodInterceptor(org.springframework.aop.Pointcut pointcut, AuthorizationManager<MethodInvocationResult> authorizationManager)
Creates an instance.- Parameters:
pointcut
- thePointcut
to useauthorizationManager
- theAuthorizationManager
to use
-
-
Method Detail
-
postAuthorize
public static AuthorizationManagerAfterMethodInterceptor postAuthorize()
Creates an interceptor for thePostAuthorize
annotation- Returns:
- the interceptor
-
postAuthorize
public static AuthorizationManagerAfterMethodInterceptor postAuthorize(PostAuthorizeAuthorizationManager authorizationManager)
Creates an interceptor for thePostAuthorize
annotation- Parameters:
authorizationManager
- thePostAuthorizeAuthorizationManager
to use- Returns:
- the interceptor
-
invoke
public java.lang.Object invoke(org.aopalliance.intercept.MethodInvocation mi) throws java.lang.Throwable
- 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)
-
setAuthorizationEventPublisher
public void setAuthorizationEventPublisher(AuthorizationEventPublisher eventPublisher)
Use thisAuthorizationEventPublisher
to publish theAuthorizationManager
result.- Parameters:
eventPublisher
-- Since:
- 5.7
-
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
-
setSecurityContextHolderStrategy
public void setSecurityContextHolderStrategy(SecurityContextHolderStrategy strategy)
Sets theSecurityContextHolderStrategy
to use. The default action is to use theSecurityContextHolderStrategy
stored inSecurityContextHolder
.- Since:
- 5.8
-
-