Non-Latin characters, openID and the openid4java library

The openid4java [1] library is a very handy set of components that handles openid and oauth for java applications and definitely worth a look before you capitulate in frustration before all that modern openid stuff.

For those of us living and working outside the 7bit-speaking ANSI niche there is one webserver setting to verify: the URIEncoding. For tomcat that would be in /conf/server.xml and should be adjusted to UTF-8:

<Connector
    port=”8080″
    URIEncoding=”UTF-8″
/>

The problem manifests itself as a strange inability to verify obviously succeeded verification requests from the openID provider when extended attributes were requested (such as name and address) which contain non-latin characters:

            VerificationResult verification = manager.verify(receivingURL.toString(), openidResp, di);
            Identifier verified = verification.getVerifiedId();

In the particular case, verified will be null.

In a regular production environment this error would not appear because one has instructed the connector to decode URIs as UTF-8.

Resources

[1] openid4java
http://code.google.com/p/openid4java/

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s