tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marco Bellavia (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (TOMEE-1470) Login not successful due to encoding problem using login-config auth-method FORM
Date Fri, 05 Dec 2014 14:14:14 GMT

    [ https://issues.apache.org/jira/browse/TOMEE-1470?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14235507#comment-14235507
] 

Marco Bellavia commented on TOMEE-1470:
---------------------------------------

Hi there, we simply assumed that this issue is specific for TomEE: the use of filters as explained
in above description is a well documented solution for Tomcat.
Additionally, our hypothesis is that the underlying TomEE architecture with the OpenEJB web
application might imply that our filter cannot set the encoding because the request has already
been read.

> 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)

Mime
View raw message