How can I get the username from a failed login using spring security?

后端 未结 7 2272
情书的邮戳
情书的邮戳 2020-12-23 18:31

We\'re using spring security 3.0.5, Java 1.6 and Tomcat 6.0.32. In our .xml config file we\'ve got:



        
7条回答
  •  滥情空心
    2020-12-23 19:05

    I did it this way:

    1. Created a class that extends SimpleUrlAuthenticationFailureHandler

    2. Overrid the onAuthenticationFailure method, which receives an HttpServletRequest as a parameter.

    3. request.getParameter("username"), where "username" is the name of my input in my HTML form.

提交回复
热议问题