Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Security rename login form tags name

I Spring Security Login form we have the following form

<form name='f' action='/j_spring_security_check' method='POST'> 
 <table> 
    <tr><td>User:</td><td><input type='text' name='j_username' value=''></td></tr> 
    <tr><td>Password:</td><td><input type='password' name='j_password'/></td></tr> 
    <tr><td colspan='2'><input name="submit" type="submit"/></td></tr> 
    <tr><td colspan='2'><input name="reset" type="reset"/></td></tr> 
  </table> 
</form>

I know how to modify action attribute on this form (using login-processing-url="/login") My question is how can I change j_username & j_password tags names, to be username and password?

like image 899
danny.lesnik Avatar asked May 29 '11 22:05

danny.lesnik


1 Answers

There is an alternative way for your request :
Spring - Security : how are login username and password bound to the authentication-provider?
Spring Security 3- How to customize username/password parameters?

But the best approach is update to Spring Security 3.1.0 (latest version is RC2, GA may release in few months from now), with the new configuration in form-login :

<beans:beans>
  <http>
    <form-login username-parameter="username" password-parameter="password" />
  </http>
</beans:beans>
like image 157
lschin Avatar answered Sep 27 '22 19:09

lschin