Mock authentication support for Spring Security

  • Tags : mockup, spring security
  • Latest : 2.0-RC2
  • Last Updated: 26 November 2013
  • Grails version : 2.0.0 > *
  • Authors : Aaron J. Zirbes
4 votes
Dependency :
compile ":spring-security-mock:2.0-RC2"

Documentation Source Issues

Summary

Mock authentication support for Spring Security

Installation

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

Description

There is a bug in the current release of spring-security-core 1.2.7.1 that breaks this plugin. A fixed version is available here until the upstream branch can be repaired: https://github.com/aaronzirbes/grails-spring-security-core/tree/1.2.7.2

Official Documentation is here: http://aaronzirbes.github.com/grails-spring-security-mock/

Source code is here: https://github.com/aaronzirbes/grails-spring-security-mock

Report issues here: https://github.com/aaronzirbes/grails-spring-security-mock/issues

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.