Package au.org.ala.web
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 ElementsModifier and TypeOptional ElementDescriptionName of the action to redirect to, defaults to indexbooleanChange the behaviour such that the user may be anonymousbooleanChange the behaviour such that the user must have only one role from the roles list to have access to the methodName of the controller to redirect to, defaults to current controllerbooleanUse a servlet forward instead of a redirectThe message to put in flashScope.errorMessage, set to null to disable.booleanChange the behaviour such that the user must *not* have any roles from the roles list to have access to the methodThe context relative uri to redirect to, this takes precedent over the controller if specified.String[]Load the roles from the Grails configuration property provided in this value.intStatus code to return instead of redirecting, takes precendence over Uri if specifiedString[]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[] valueA 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 anonymousChange the behaviour such that the user may be anonymous- Returns:
- whether the user may be anonymous
- Default:
- false
-
anyRole
boolean anyRoleChange 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 notRolesChange 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 controllerName 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 actionName 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 redirectUriThe 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 statusCodeStatus code to return instead of redirecting, takes precendence over Uri if specified- Returns:
- The status code to return
- Default:
- 0
-
message
String messageThe 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 forwardUse a servlet forward instead of a redirect- Returns:
- true to use forward instead of redirect
- Default:
- false
-
rolesFromProperty
String[] rolesFromPropertyLoad the roles from the Grails configuration property provided in this value.- Returns:
- Default:
- {}
-