Hi,

I found that JetSpeed does not support UTF-8 encoded usernames. If you login
as an admin and create a user with name in East Asian language, or with
other non-regular letters, like "รค" (alt+132), you can do it. But if you
type that new name in the login page, you would get a "Wrong user name"
error message, with the name screwed on UI.

The name can be kept if you add
       request.setCharacterEncoding("UTF-8");
at the beginning of org.apache.jetspeed.login.LoginProxyServlet.goGet. But
you still won't be able to login, because this piece of code.

           Callback[] callbacks = new Callback[] { new
NameCallback("Username: "), new PasswordCallback("Password: ", false) };
           callbackHandler.handle(callbacks);
           username = ((NameCallback) callbacks[0]).getName();

I assume that's how people get the user name. If the username typed in was
UTF-8 encoded, here the username is wrong already.

The logic which causes this problem, which seems to me, is the
callbackHandler, which is an instance of
javax.security.auth.login.LoginContext.SecureCallbackHandler

I guess that's something out of our control.

I heard a workaround to get the bytes from the screwed username above, and
use those bytes to reconstruct a string UTF-8 encoded. But I am afraid that
in the future if this issue is fixed by javax..., I would double encode it.

Anybody has any ideas/suggestions?

Thanks,

Jay
--
(Jay) Jun Yan

Reply via email to