Got HTTP 405 status when exiting Grails application using Spring Security Plugin

I am adding Spring Security Plugin (2.0 RC3) to my Grails application (2.4.4). However, after clicking the "Exit" link, I see a web page with HTTP Status 405 .

How can this be fixed?

+6
source share
1 answer

The reason for this may be the analysis of the 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 } } 

Thus, two fixes are available:

1) Modify the Exit link to send a POST request.

 <form name="logout" method="POST" action="${createLink(controller:'logout') }"> <input type="submit" value="logout"></form> 

2) Or just add the following line to Config.groovy

 grails.plugin.springsecurity.logout.postOnly = false 
+17
source

Source: https://habr.com/ru/post/982133/


All Articles