I'm adding Spring Security plugin(2.0 RC3) to my Grails app(2.4.4). However, once clicking 'Logout' link i see the web page with HTTP Status 405
.
How this could be fixed?
The reason of that could be found by analysis of LogoutController code
class LogoutController {
def index() {
if (!request.post && SpringSecurityUtils.getSecurityConfig().logout.postOnly) {
response.sendError HttpServletResponse.SC_METHOD_NOT_ALLOWED // 405
return
}
// TODO put any pre-logout code here
redirect uri: SpringSecurityUtils.securityConfig.logout.filterProcessesUrl
}
}
So there are two fixes available:
1) Change 'Logout' link to send POST request.
<form name="logout" method="POST" action="${createLink(controller:'logout') }">
<input type="submit" value="logout"></form>
2) Or just add following line to Config.groovy
grails.plugin.springsecurity.logout.postOnly = false
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With