Installation
- grails create-project shiroPluginTest
- cd shiroPluginTest
- grails install-plugin shiro
- grails shiro-quick-start --prefix="Sec"
automatically create : domain/SecUser, domain/SecRole, controller/AuthController , Config/ShiroSecurityFilter - insert some data into Project. edit "Config/Bootstrap.groovy"Bootstrap.groovy
classBootStrap {def init = { servletContext ->def u1 =newSecUser(username:'user', passwordHash:newSha1Hash('user').toHex())u1.save()def u2 =newSecUser(username:'admin', passwordHash:newSha1Hash('admin').toHex())u2.save()def role=newSecRole(name:'user').addToUsers(u1)role.addToPermissions("*:*")role.save()def role2=newSecRole(name:'admin').addToUsers(u2)role2.addToPermissions("*:*")role2.save()}def destroy = {}} - grails create-controller shiroTest
- grails generate-views shiroTest
- grails run-app
- try to go to any page, and see the login page is work correct
install the LDAP server
........(still working)
沒有留言:
張貼留言