Annotation Interface AlaSecured


@Target({TYPE,METHOD,FIELD}) @Retention(RUNTIME) @Documented @Inherited public @interface AlaSecured
Cut down version of the Spring Security @Secured annotation that will allow role based authorisation on Grails controllers and controller actions *only*.
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Name of the action to redirect to, defaults to index
    boolean
    Change the behaviour such that the user may be anonymous
    boolean
    Change the behaviour such that the user must have only one role from the roles list to have access to the method
    Name of the controller to redirect to, defaults to current controller
    boolean
    Use a servlet forward instead of a redirect
    The message to put in flashScope.errorMessage, set to null to disable.
    boolean
    Change the behaviour such that the user must *not* have any roles from the roles list to have access to the method
     
     
    The context relative uri to redirect to, this takes precedent over the controller if specified.
    Load the roles from the Grails configuration property provided in this value.
    int
    Status code to return instead of redirecting, takes precendence over Uri if specified
    A list of roles that the user must have to have access to the method, if omitted then the user must be logged in.
     
  • Element Details

    • value

      String[] value
      A list of roles that the user must have to have access to the method, if omitted then the user must be logged in.
      Returns:
      the list of roles
      Default:
      {}
    • anonymous

      boolean anonymous
      Change the behaviour such that the user may be anonymous
      Returns:
      whether the user may be anonymous
      Default:
      false
    • anyRole

      boolean anyRole
      Change the behaviour such that the user must have only one role from the roles list to have access to the method
      Returns:
      whether any role from the list is acceptable
      Default:
      false
    • notRoles

      boolean notRoles
      Change the behaviour such that the user must *not* have any roles from the roles list to have access to the method
      Returns:
      whether having any role from the list is unacceptable
      Default:
      false
    • controller

      String controller
      Name of the controller to redirect to, defaults to current controller
      Returns:
      The Grails controller to redirect to if authorization fails
      Default:
      ""
    • redirectController

      String redirectController
      Default:
      ""
    • action

      String action
      Name of the action to redirect to, defaults to index
      Returns:
      The action to redirect to if authorization fails
      Default:
      ""
    • redirectAction

      String redirectAction
      Default:
      ""
    • view

      String view
      Default:
      ""
    • redirectUri

      String redirectUri
      The context relative uri to redirect to, this takes precedent over the controller if specified.
      Returns:
      the URI to redirect to if authorization fails
      Default:
      ""
    • statusCode

      int statusCode
      Status code to return instead of redirecting, takes precendence over Uri if specified
      Returns:
      The status code to return
      Default:
      0
    • message

      String message
      The message to put in flashScope.errorMessage, set to null to disable.
      Returns:
      The flash scope message to use if authorization fails
      Default:
      "Permission denied"
    • forward

      boolean forward
      Use a servlet forward instead of a redirect
      Returns:
      true to use forward instead of redirect
      Default:
      false
    • rolesFromProperty

      String[] rolesFromProperty
      Load the roles from the Grails configuration property provided in this value.
      Returns:
      Default:
      {}