Annotation Type RequiresRoles


  • @Target({TYPE,METHOD})
    @Retention(RUNTIME)
    public @interface RequiresRoles
    The RequiresRoles annotation requires the current Subject to have all of the specified roles. If they do not have the role(s), the method will not be executed and an AuthorizationException is thrown. The logical operation for the permission check in case multiple roles are specified. AND is the default.

    For example:

    
     @RequiresRoles({"Administrator"})
     public void createAccount(Account account) {
        //this method will only be invoked by an admin
     }
     
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String[] value
      A single String role name or multiple comma-delimited role names required in order for the method invocation to be allowed.
    • Element Detail

      • value

        java.lang.String[] value
        A single String role name or multiple comma-delimited role names required in order for the method invocation to be allowed.
        Returns:
        the string [ ]