Search code examples
grailsspring-securitygrails-plugin

Grails spring-security-core plugin


Is it possible to modify and let grails spring-security-core plugin utilize other beans defined in e.g /WEB-INF/applicationContext-security.xml?

Has anyone successfully been able to run for example a minimalistic case of spring-security:

<http>
    <http-basic/>
    <intercept-url pattern="/**" access="ROLE_ADMIN" />
</http>
<authentication-manager>
    <authentication-provider>
        <user-service>
            <user name="admin" password="pass" authorities="ROLE_ADMIN" />
        </user-service>
    </authentication-provider>
</authentication-manager>

Having Grails spring-security-core plugin installed, so that the grails plugin does not redirect it and use its own beans instead?

In that case, where and how do you specify this in order to make this possible?


Solution

  • Don't edit /WEB-INF/applicationContext-security.xml - this is the Grails parent application context definition file. If you want to use XML syntax instead of resources.groovy, create a file called resources.xml in the same folder and put the bean definitions there. The format is the same as any Spring XML file.

    But you can't mix Spring Security XML bean definitions with the plugin's, since the approach is very different, in particular several bean names are not the same.