How to get the reason of login failure in clients while using Grails Spring Security Rest plugin?

自作多情 提交于 2019-12-24 16:03:42

问题


We are using Grails Spring Security Rest plugin 1.5.2 with Grails 2.5.2.

Unfortunately it doesn't seem to report any reason of why a login failure occurred. The only thing we get from the login request is HTTP 401.

We have a mechanism where after a number of login failures we set the accountLocked property of the User, so the account becomes disabled/locked.

We would like to get at least a JSON response of why the login failed, like "User account is locked", "Bad credentials", "No such user", etc.

Is there a way to do this with current versions that we use?


回答1:


The plugin doesn't support that out of the box. However, you can easily workaround it by replacing RestAuthenticationFailureHandler with your own implementation and wiring it in resources.groovy as restAuthenticationFailureHandler.



来源:https://stackoverflow.com/questions/33691333/how-to-get-the-reason-of-login-failure-in-clients-while-using-grails-spring-secu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!