Annotation Type RolesAllowed


@Retention(CLASS) @Target({METHOD,TYPE}) public @interface RolesAllowed

Lets this method -- or every public method of this class -- run only for a caller holding one of these roles: @RolesAllowed("ADMIN") asks for the authority ROLE_ADMIN. A role written with the ROLE_ prefix is taken as it is.

Checked the way PreAuthorize is, self-calls and private methods included; an annotation on a method replaces the one on its class.

  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The roles, any one of which is enough.
  • Element Details

    • value

      String[] value
      The roles, any one of which is enough.