public class ExampleAnnotationBasedMethodInvocationAuthorizer extends Object implements MethodInvocationAuthorizer
| Constructor and Description |
|---|
ExampleAnnotationBasedMethodInvocationAuthorizer() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
authorize(Method method,
Object target)
Executes the authorization logic to determine whether the
method is allowed to be
executed on the target object instance. |
void |
initialize(Cache cache,
Set<String> parameters)
|
public ExampleAnnotationBasedMethodInvocationAuthorizer()
public void initialize(Cache cache, Set<String> parameters)
MethodInvocationAuthorizerCache and a Set of
String parameters.
This method exists to allow user-specified method authorizers to be configured and used at
runtime. If this method is not overridden in a user-specified authorizer then that authorizer
will not be configurable.initialize in interface MethodInvocationAuthorizercache - the Cache to which the MethodInvocationAuthorizer will belongparameters - a Set of String that will be used to configure thepublic boolean authorize(Method method, Object target)
MethodInvocationAuthorizermethod is allowed to be
executed on the target object instance.
Implementation Note: the query engine will remember whether the method invocation has
been already authorized or not for the current query context, so this method will be called
once in the lifetime of a query for every new method seen while traversing the objects.
Nevertheless, the implementation should be lighting fast as it will be called by the
OQL engine in runtime during the query execution.authorize in interface MethodInvocationAuthorizermethod - the Method that should be authorized.target - the Object on which the Method will be executed.true if the method is annotated with Authorized and not permanently
forbidden, false otherwise