JSecurity is another Java POJO oriented security framework that again provides a default domain model that models realms, users, roles and permissions. With JSecurity you have to extends a controller base called called
JsecAuthBase
in each controller you want secured and then provide an
accessControl
block to setup the roles. An example below:
class ExampleController extends JsecAuthBase {
static accessControl = {
// All actions require the 'Observer' role.
role(name: 'Observer') // The 'edit' action requires the 'Administrator' role.
role(name: 'Administrator', action: 'edit') // Alternatively, several actions can be specified.
role(name: 'Administrator', only: [ 'create', 'edit', 'save', 'update' ])
} …
}
For more information on the JSecurity plug-in refer to the
JSecurity Quick Start.