[英]How to get Authenticated with spring security rest plugin in Grails
[英]How to get the reason of login failure in clients while using Grails Spring Security Rest plugin?
我們正在使用Grails Spring Security Rest插件1.5.2和Grails 2.5.2。
不幸的是,它似乎沒有報告任何導致登錄失敗的原因。 從登錄請求中獲得的唯一內容是HTTP 401
。
我們有一種機制,在多次登錄失敗后,我們設置User
的accountLocked
屬性,因此該帳戶將被禁用/鎖定。
我們希望至少獲得有關登錄失敗原因的JSON響應,例如“用戶帳戶已鎖定”,“錯誤的憑據”,“沒有此類用戶”等。
有沒有辦法對我們使用的當前版本執行此操作?
該插件不支持該功能。 但是,您可以通過用您自己的實現替換RestAuthenticationFailureHandler並將其連接到resources.groovy
作為restAuthenticationFailureHandler
來輕松解決此restAuthenticationFailureHandler
。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.