Plugins You can find out about all the publicly available Grails plugins.

Mock authentication support for Spring Security

  • Authors: Aaron J. Zirbes
4 votes
compile "org.grails.plugins:spring-security-mock:2.0-RC2"

 Documentation  Source  Issues


Mock authentication support for Spring Security


Add the following to your grails-app/conf/BuildConfig
plugins {
    provided ":spring-security-mock:1.0.1"

or run

grails install-plugin spring-security-mock


There is a bug in the current release of spring-security-core that breaks this plugin. A fixed version is available here until the upstream branch can be repaired:

Official Documentation is here:

Source code is here:

Report issues here:

You can now load your own userDetailsService in your resources.groovy file. Plus, if you have spring-security-ldap configured and active, it will automatically mock the authentication, but load roles from LDAP.

The Mock plugin adds support for adding "mock" authentication to a Grails applications that uses Spring Security. It depends on the Spring Security Core plugin. This is helpful when the spring security implementation is tied to localized infrastructure such as LDAP, CAS, Shibboleth, or something of the like.

The username and roles mocked up by the plugin are configurable within your Config.groovy file.

It is suggested that you restrict spring security to only allow access from localhost when using this plugin to prevent unwanted access to your application when authentication is being bypassed.

It is recommended that you wrap the configuration settings for this plug-in to only load when in development, or possibly test mode.