You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by "Marco Bellavia (JIRA)" <ji...@apache.org> on 2014/12/05 12:15:12 UTC
[jira] [Created] (TOMEE-1470) Login not successful due to encoding
problem using login-config auth-method FORM
Marco Bellavia created TOMEE-1470:
-------------------------------------
Summary: Login not successful due to encoding problem using login-config auth-method FORM
Key: TOMEE-1470
URL: https://issues.apache.org/jira/browse/TOMEE-1470
Project: TomEE
Issue Type: Bug
Affects Versions: 1.7.1
Environment: CentOS
Reporter: Marco Bellavia
Our ear application comes with an authentication configuration in web.xml as follows:
...
<login-config>
<auth-method>FORM</auth-method>
<realm-name>jdbc-realm</realm-name>
<form-login-config>
<form-login-page>login.jsp</form-login-page>
<form-error-page>error.jsp</form-error-page>
</form-login-config>
</login-config>
...
We noticed that the authentification with a password containing special characters (for example umlauts) fails with our TomEE instance running on CentOS Linux (while on Windows the problem does not occur).
Our application was previously deployed on a Glassfish 3.1, where we were not experiencing the phenomen just described. There we could configure the default charset using the directive <parameter-encoding default-charset="UTF-8"/> in sun-web.xml.
All other encoding configurations are set to UTF-8.
We notice the following while debugging under TomEE: calling the method getCharacterEncoding() on the ServletRequest returns NULL, which implies that TomEE takes as default ISO-8859-1 on CentOS.
As recommended here: http://wiki.apache.org/tomcat/FAQ/CharacterEncoding#Q3 we set a character encoding filter. On TomEE the recommended solution doesn't seem to be working. A SetCharacterEncodingFilter was placed as first in the chain setting the encoding to UTF-8.
We assume that setting the encoding of the request on a TomEE - as the filter does - happens too late.
As workaround we implemented a customized jdbc-realm class, where we convert the encoding to UTF-8 by:
public Principal authenticate(final String username, final String credentials) {
...
final String utf8EncodedCredentials = new String(credentials.getBytes("ISO-8859-1"),"UTF-8");
...
}
We would welcome a general solution.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)