如何定制Grails Spring Security Core 2登录/注销控制器和视图? [英] How to customize Grails Spring Security Core 2 login / logout controller and views?
问题描述
我使用新的Grails Spring Security Core 2.0插件,想知道如何自定义登录视图和LoginController / LogoutController?
I am using the new Grails Spring Security Core 2.0 plugin and am wondering how i can customize the login view and the LoginController/LogoutController?
以前版本的插件生成这些文件,但现在看来,我不得不将它们从插件复制到我的项目。这是正确的做法吗?
The previous versions of the plugin generated these files but now it seems that I have to copy them from the plugin to my project. Is this the correct approach?
如果是这样,我可以将复制的控制器和视图放到另一个包中,然后是原始包。 IntelliJ似乎不喜欢在同一个包中具有相同的工件。
And if so, can I put the copied controllers and views into another package then the original ones. IntelliJ seems to dislike having the same artifacts in the same package.
推荐答案
默认情况下,2.0版注销只能通过POST请求。要更改此以允许GET请求,请将以下内容添加到您的Config.groovy文件中。
By default in version 2.0 logouts are only allowed via POST requests. To change this to allow GET requests add the following to your Config.groovy file.
grails.plugin.springsecurity.logout.postOnly = false
一旦您拥有了该设置,您就可以直接链接到注销控制器以注销
Once you have that set you can link directly to logout controller in order to logout
<g:link controller="logout">logout</g:link>
如果您想要了解更多信息,请参阅版本2中的其他内容。 2.0版新增功能文档
If you want to find more info on what else was changed in version 2 look to the What's New in Version 2.0 documentation
这篇关于如何定制Grails Spring Security Core 2登录/注销控制器和视图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!