Class ExampleAnnotationBasedMethodInvocationAuthorizer

  • java.lang.Object
    • org.apache.geode.examples.security.ExampleAnnotationBasedMethodInvocationAuthorizer
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean authorize​(java.lang.reflect.Method method, java.lang.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, java.util.Set<java.lang.String> parameters)
      Initializes the MethodInvocationAuthorizer using a Cache and a Set of String parameters.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ExampleAnnotationBasedMethodInvocationAuthorizer

        public ExampleAnnotationBasedMethodInvocationAuthorizer()
    • Method Detail

      • initialize

        public void initialize​(Cache cache,
                               java.util.Set<java.lang.String> parameters)
        Description copied from interface: MethodInvocationAuthorizer
        Initializes the MethodInvocationAuthorizer using a Cache 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.

        Specified by:
        initialize in interface MethodInvocationAuthorizer
        Parameters:
        cache - the Cache to which the MethodInvocationAuthorizer will belong
        parameters - a Set of String that will be used to configure the
      • authorize

        public boolean authorize​(java.lang.reflect.Method method,
                                 java.lang.Object target)
        Description copied from interface: MethodInvocationAuthorizer
        Executes the authorization logic to determine whether the method is allowed to be executed on the target object instance.

        Implementation Note: this method is called for every method invocation reached while traversing query results, for every target object seen, since the verdict may depend on the specific target instance (for example, per-Region access checks) and not solely on the Method being invoked. The implementation should therefore be lightning fast, as it will be called by the OQL engine at runtime during query execution.

        Specified by:
        authorize in interface MethodInvocationAuthorizer
        Parameters:
        method - the Method that should be authorized.
        target - the Object on which the Method will be executed.
        Returns:
        true if the method is annotated with ExampleAnnotationBasedMethodInvocationAuthorizer.Authorized and not permanently forbidden, false otherwise