Annotation Type Privilege


  • @Retention(RUNTIME)
    @Target(PACKAGE)
    @Documented
    @PackageQualified
    public @interface Privilege
    Defines a logical security Privilege, that a caller must have in order to access a resource. A caller is deemed to have a Privilege IFF they have at least one of the roles enumerated by the roles() property. A Privilege must be defined at the package level in package-info.java. If more than one Privilege is to be defined per package then wrapper it in a Security annotation. If a Privilege must be defined dynamically (i.e. at run-time), rather than statically via a package annotation, then implement a HasPrivileges provider that can map privilege names to Privilege instances.
    Author:
    cdivilly
    • Required Element Summary

      Required Elements 
      Modifier and Type Required Element Description
      java.lang.String name
      The unique name/identifier of the Privilege
    • Optional Element Summary

      Optional Elements 
      Modifier and Type Optional Element Description
      java.lang.String[] roles
      To access the resource, the caller must have at least one of the specified roles
    • Element Detail

      • name

        java.lang.String name
        The unique name/identifier of the Privilege
        Returns:
        privilege name
      • roles

        java.lang.String[] roles
        To access the resource, the caller must have at least one of the specified roles
        Returns:
        required roles
        Default:
        {}