Annotation Interface RequiresPermissions


@Target({TYPE,METHOD}) @Retention(RUNTIME) public @interface RequiresPermissions
The RequiresPermissions annotation requires the current Subject be permitted one or more permissions in order to execute the annotated method. The logical operation for the permission checks in case multiple permissions are specified. AND is the default

For example:


 @RequiresPermissions("account:create")
 public void createAccount(Account account) {
    //this method will only be invoked by a Subject that is permitted to create an account
 }
 

 @RequiresPermissions({"account:manage", "account:create"})
 public void createAccount(Account account) {
    //this method will only be invoked by a Subject that is permitted to manage AND create an account.
 }
 
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The permission string which will be passed to Subject.isPermitted(String) to determine if the user is allowed to invoke the code protected by this annotation.
  • Element Details

    • value

      String[] value
      The permission string which will be passed to Subject.isPermitted(String) to determine if the user is allowed to invoke the code protected by this annotation.
      Returns:
      the string [ ]