How to configure Grails Spring Security Core 2 I / O controller and views?

I am using the new Grails Spring Security Core 2.0 plugin and I am wondering how can I customize the login view and LoginController / LogoutController?

Previous versions of the plugin generated these files, but now it seems that I need to copy them from the plugin to my project. Is this the right approach?

And if so, can I put the copied controllers and views in another package, and then in the original ones. IntelliJ doesn't seem to like having the same artifacts in one package.

+7
spring spring-security grails
source share
3 answers

By default, in versions 2.0, outputs are only allowed through POST requests. To change this to allow GET requests, add the following to the Config.groovy file.

grails.plugin.springsecurity.logout.postOnly = false 

Once you have this kit, you can directly link it to the exit controller to exit the system

 <g:link controller="logout">logout</g:link> 

If you want to find more information about what else was changed in version 2, see What's New in Version 2.0

+5
source share

Another option is to use a remote link , which by default uses the "post" method

  <g:remoteLink class="logout" controller="logout">${message(code: 'springSecurity.logout.link')}</g:remoteLink> 
+2
source share

I do not think that any of the above answers really answer the question.

If you want to override the controllers and views in your web application, then copy them to your web application. You can even give them a different package hierarchy if you want, since the spring-security-core plugin refers to them at the URL, and yours will replace them.

This works because the controllers and views declared in the main web application take precedence over those found in the plugins.

However, if you do this in another plugin, when things get a little more complicated. See this questionnaire and answer to solve this problem.

+1
source share

All Articles