Annotation Interface RequiredPermission


@Documented @Retention(RUNTIME) @Target({TYPE,METHOD}) public @interface RequiredPermission
Specifies the permission required to access methods.

This annotation can be specified on a class or on method(s). Specifying it at a class level means that it applies to all the methods in the class. Specifying it on a method means that it is applicable to that method only. If applied at both the class and methods level, the method value overrides the class value.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The permission required to access the method
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    References a method on the resource which accepts the scope as string, and returns the required minimum permission on that scope.
    The name of the query parameter / path parameter containing the actual value.
    boolean
    Whether the scope is optional.
  • Element Details

    • scope

      String scope
      The name of the query parameter / path parameter containing the actual value. The returned value can be used to obtain the value from the actual request URI.
      Default:
      ""
    • scopeOptional

      boolean scopeOptional
      Whether the scope is optional. This can be used when the annotation is placed on the interface, and there are methods with and without the scope parameter.
      Default:
      false
    • dynamicPermission

      String dynamicPermission
      References a method on the resource which accepts the scope as string, and returns the required minimum permission on that scope.

      The referenced method will be called during checks for required permissions on the annotated object, using the value of the parameter denoted by the scope parameter and is expected to return an object of type ScopedPermission.Permission or null if no permission is required.

      Default:
      ""