Shiro User Interface

  • Tags: security, ui, frontend
  • Latest: 1.0-beta4
  • Last Updated: 18 August 2011
  • Grails version: 1.3.7
  • Authors: Yellowsnow
1 vote
Dependency:
compile ":shiro-ui:1.0-beta4"

 Source  Issues

Summary

A basic Shiro User Interface

Installation

grails install-plugin shiro-ui

Description

This plugin tries to provide a basic user interface for shiro plugin. It depends on the excellent Apache shiro and Mail plugins.

The ShiroDBRealm is used in this plugin, this assumes users, roles and permissions are stored in the database.

Installation

grails install-plugin shiro-ui

Feature summary

  • User and Role management frontends with basic permission configuration : ${appName}/shiroUser/ and ${appName}/shiroRole/
  • Password recovery via email : ${appName}/auth/lostPassword
  • Password update : ${appName}/auth/updatePassword
  • User creation by priviliged user with temporary password sent by email (password update is requested on log on)
During installation, all templates (controllers, domain classes and views) are directly copied to the project.

Admin user creation

Admin user creation can be done in the Bootstrap :

import org.apache.shiro.crypto.hash.Sha256Hash

class BootStrap {

def init = { servletContext ->

def adminRole = ShiroRole.findByName("Administrator")

if(!adminRole){

adminRole = new ShiroRole(name: 'Administrator')

adminRole.addToPermissions("*:*")

adminRole.save()

}

def admin = ShiroUser.findByUsername('admin')

if(!admin){

admin = new ShiroUser(firstName:"Administator",lastName:"User",

username: 'admin', passwordHash: new Sha256Hash("changeit").toHex(),email:'someone@gmail.com')

admin.save()

adminRole.addToUsers(admin)

adminRole.save()

}

}

def destroy = {

}

}

Plugin RoadMap

  • Allow custom permissions such as "book:buy,sell:1,2"
  • External mail templates (now hardcoded in controller)
  • Script to manually install templates
  • User sign-up with admin approval