public abstract class AuthorizingAnnotationMethodInterceptor extends AnnotationMethodInterceptor
Constructor and Description |
---|
AuthorizingAnnotationMethodInterceptor(AuthorizingAnnotationHandler handler)
Constructor that ensures the internal
handler is set which will be used to perform the
authorization assertion checks when a supported annotation is encountered. |
AuthorizingAnnotationMethodInterceptor(AuthorizingAnnotationHandler handler,
AnnotationResolver resolver) |
Modifier and Type | Method and Description |
---|---|
void |
assertAuthorized(MethodInvocation mi)
Ensures the calling Subject is authorized to execute the specified
MethodInvocation . |
Object |
invoke(MethodInvocation methodInvocation)
Ensures the
methodInvocation is allowed to execute first before proceeding by calling the
assertAuthorized method first. |
getAnnotation, getHandler, getResolver, setHandler, setResolver, supports
getSubject
public AuthorizingAnnotationMethodInterceptor(AuthorizingAnnotationHandler handler)
handler
is set which will be used to perform the
authorization assertion checks when a supported annotation is encountered.handler
- the internal handler
used to perform authorization assertion checks when a
supported annotation is encountered.public AuthorizingAnnotationMethodInterceptor(AuthorizingAnnotationHandler handler, AnnotationResolver resolver)
handler
- resolver
- public Object invoke(MethodInvocation methodInvocation) throws Throwable
methodInvocation
is allowed to execute first before proceeding by calling the
assertAuthorized
method first.methodInvocation
- the method invocation to check for authorization prior to allowing it to proceed/execute.MethodInvocation.proceed()
).AuthorizationException
- if the MethodInvocation
is not allowed to proceed.Throwable
- if any other error occurs.public void assertAuthorized(MethodInvocation mi) throws AuthorizationException
MethodInvocation
.
As this is an AnnotationMethodInterceptor, this implementation merely delegates to the internal
AuthorizingAnnotationHandler
by first acquiring the annotation by
calling getAnnotation(methodInvocation)
and then calls
handler.assertAuthorized(annotation)
.mi
- the MethodInvocation
to check to see if it is allowed to proceed/execute.AuthorizationException
- if the method invocation is not allowed to continue/execute.Copyright © 2004–2020 The Apache Software Foundation. All rights reserved.