简体   繁体   中英

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

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?

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM