I have set up form based authentication in my application using Tomcat 6 and MySQL 5.0. It works just fine when using English user names and passwords. But, if I use Korean, Japanese, or other Unicode characters, then the login fails.
How can I get form based authentication to work with Unicode?
The database uses UTF-8. And yes, I can query the user name string out correctly.
I have no idea how to check to see if the information is being passed to j_security_check correctly or not. Yesterday I tried to create a filter that would check that for me, but I found that you cannot use filters to see j_security_check requests.
How would I check the j_username and j_password parameters?
Joined: Sep 23, 2009
I now have it working. Finally.
I made two changes in my configuration files. I'm not entirely sure which one fixed it or if they are both necessary. But just for your information, here are the two changes.
1. Since I am using MySQL as the user database, the Realm's connection URL to the database needed to have the encoding information. Here is what I now have in my context.xml file:
2. I also added the following tag to the context.xml file. It explicitly tells Tomcat's FormAuthenticator to use utf-8 encoding:
And as a final note, I made these changes and restarted my Tomcat, but it still did not work until I came back to work the next day. (And, yes, I did indeed spend several hours searching for answers. I found nothing and went home frustrated.) Therefore, if it is not working for you, you may want to reboot the computer just to make sure...