greenbays / openid4java

Automatically exported from code.google.com/p/openid4java
0 stars 0 forks source link

Character encoding problem when verifying 'sreg' data. #28

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. RP requsets auth with SRegRequest.
2. Response comes from IDP with SRegResponse which includes Korean character.
3. Vecification is failed.

[code: when requesting]
// associate, create discovery, create AuthRequest...
SRegRequest sreg = SRegRequest.createFetchRequest();
sreg.addAttribute("email", true);
sreg.addAttribute("nickname", true);
authReq.addExtension(sreg);
// redirect to IDP...

[code: when responsing]
ParameterList params = new ParameterList(request.getParameterMap());
StringBuffer recvUrl = request.getRequestURL();
String query = request.getQueryString();
if (!StringUtils.isBlank(query)) 
    recvUrl.append("?").append(query);
VerificationResult v = consumerManager.verify(recvUrl.toString(), params,
discInfo);

What is the expected output? What do you see instead?
Verification failed.

What version of the product are you using? On what operating system?
java-openid-sxip-0.9.3.265
Windows XP

Please provide any additional information below.

I changed 'sign(String)' method in 'Association.java' as followings.

    public String sign(String text) throws AssociationException
    {
        if (DEBUG) _log.debug("Computing signature for input data:\n" + text);
        try {
            return new
String(Base64.encodeBase64(sign(text.getBytes("utf-8"))), "utf-8");
        } catch (UnsupportedEncodingException e) {}
    }

and, it works well.

Original issue reported on code.google.com by scki...@gmail.com on 21 Sep 2007 at 7:31

GoogleCodeExporter commented 8 years ago
Thanks for the patch! This is fixed now in rev 334.

Johnny

Original comment by Johnny.B...@gmail.com on 24 Sep 2007 at 7:00