http://docs.codehaus.org/display/GRAILS/AcegiSecurity+Plugin+-+Basic+Tutorial
However, this document is not updated with the latest Acegi. You need pay attention to several issue when you create role, requestmap. Otherwise, it will not work for your.
When you create a role, the role name should include "ROLE" (case sensitive): i.e: ROLE_admin. And this is the quick steps to plugin acegi into your grails project:
1.1: Install the Acegi plugin
> grails install-plugin acegi
1.2: CREATE THE USER, ROLE, AND REQUESTMAP DOMAIN CLASSES
> grails create-auth-domains User Role Requestmap
1.3: OPTIONAL - CREATE CONTROLLERS AND GSPS FOR USER, ROLE, AND REQUESTMAP DOMAIN CLASSES
> grails generate-manager
1.4: OPTIONAL - CREATE CONTROLLERS AND GSPS FOR CAPTCHA, REGISTER, AND AN EMAILER SERVICE.
> grails generate-registration
1.5: CREATE A CONTROLLER THAT WILL BE RESTRICTED BY ROLE
> grails create-controller Secure
2.1: Create role
http://localhost:8080/demo/role
attention - And role name should be start with "ROLE" - i.e: ROLE_ADMIN, ROLE_USER
2.2: Create user
http://localhost:8080/demo/user
2.3: create url request map
http://localhost:8080/demo/requestmap
please add the following url:
/user/** /role/** /adminpage/** /requestmap/**
ROLE_ADMIN
2.4: login to admin page
http://localhost:8080/demo/adminpage
No comments:
Post a Comment