(Quick Reference)

4 Configuration - Reference Documentation

Authors: Aaron J. Zirbes

Version: 0.9.9

4 Configuration

There are a few configuration options for the "Mock" plugin.

This plugin exposes a rather large security hole in your application. It is HIGHLY recommended that you restrict access to your application to localhost when you are using this plugin, and that you only use this plugin in development mode. This can be done with the ipRestrictions configuration parameter.

All of these property overrides must be specified in grails-app/conf/Config.groovy using the grails.plugins.springsecurity suffix, for example
grails.plugins.springsecurity.mock.username = 'aaronzirbes'

NameDefaultMeaning
mock.activefalsewhether the plugin is enabled or not (e.g. to disable per-environment)
mock.fullName'Fake User Account'the full name of the mock user being automatically logged in
mock.email'fakeexample.org'the email address of the mock user being automatically logged in
mock.username'fakeuser'the username of the mock user being automatically logged in
mock.roles'ROLE_USER', 'ROLE_ADMIN'a collection of roles that will be automatically assigned to the mock user being auto-logged in to your application
mock.load.daofalsewhether or not the plugin trys to load roles from GORM instead of the mock.roles@ setting

Configuration settings from spring-security-ldap that affect the behavior of this plugin

If all three of these settings are configured and enabled, then the Mock plugin will attempt to load roles from LDAP rather than from the mock.roles configuration setting.

NameDefaultMeaning
ldap.activetruethis must be set to true for spring-security-mock to load roles from LDAP
ldap.authorities.retrieveGroupRolestruethis must be set to true for spring-security-mock to load roles from LDAP
ldap.usernameMapper.userDnBasenone, must be setthis must be set to true for spring-security-mock to load roles from LDAP. This will be used to build the userDn that will be used to search LDAP for roles associated with the user. The full DN will be equivalent to "cn=${username},${userDnBase}"

Using a different User Details Service

You can use any User Details Service with the Mock plugin as long as it implements GrailsUserDetailsService. This is accomplished by setting the userDetailsService in your grails-app/conf/spring/resources.groovy file.

For example:

beans = {
   userDetailsService(com.mycompany.myapp.MyUserDetailsService)
}