j_spring_security_check problem with UTF8 symbols
Hello!
I have users with Russian characters in usernames in my database. Names are stored in UTF-8 encoding.
I have simple login form
HTML Code:
<%@page contentType="text/html;charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Login page</title>
</head>
<body>
<form name="f" action="j_spring_security_check" method="POST">
<table>
<tr><td>Логин:</td><td><input type='text' name='j_username' value='qweqwe'/></td></tr>
<tr><td>Пароль:</td><td><input type='password' name='j_password'></td></tr>
<tr><td><input type="checkbox" name="_spring_security_remember_me"></td><td>Don't ask for my password for two weeks</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>
</body>
</html>
But when I try to login using Russian username I get
Code:
22:38:27,272 WARN LoggerListener:60 - Authentication event AuthenticationFailureBadCredentialsEvent: ?а?????????░???╗; details: org.springframework.s
ecurity.ui.WebAuthenticationDetails@166c8: RemoteIpAddress: 95.132.70.176; SessionId: 5C3842B23ACE43BFC0581D646287021E; exception: Bad credentials
When I use programmatic login
Code:
AuthenticationManager manager = (AuthenticationManager) appContext.getBean("_authenticationManager");
manager.authenticate(usernamePasswordAuthenticationToken);
everithing is fine. The same user is able to log in.
So what should I do to enable utf-8 support in j_spring_security_check ?