kmoonki / oauth

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

Java library sends an empty realm on every OAuthClient.invoke() #66

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following code shows how to reproduce the problem.

    String guid = "guid goes here";
    OAuthMessage guidRequest = new OAuthMessage("GET",
"http://social.yahooapis.com/v1/user/" + guid + "/profile", OAuth.newList());
    guidRequest.getHeaders().add(new OAuth.Parameter("Accept",
"application/json"));
     guidRequest.addRequiredParameters(accessor);

    OAuthMessage result = client.invoke(guidRequest,
OAuthClient.ParameterStyle.AUTHORIZATION_HEADER);

The realm in the Authorization header is always empty. Yahoo! doesn't allow
an empty realm parameter. The parameter either needs to be omitted or
should be set to yahooapis.com. There's no way to convince OAuthClient to
set or exclude the realm parameter.

Original issue reported on code.google.com by rcken...@gmail.com on 23 Nov 2008 at 6:52

GoogleCodeExporter commented 9 years ago
Patch that causes the client not to send a realm parameter at all over sending 
an
empty one.

Original comment by rcken...@gmail.com on 24 Nov 2008 at 7:51

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks for the patch.  I committed something similar as -r815.

Original comment by jmkrist...@gmail.com on 26 Nov 2008 at 10:50

GoogleCodeExporter commented 9 years ago
Where should OAuthClient get the realm value for a request (assuming the 
application 
needs to send one)?  Currently the only possibility is to construct a subclass 
of 
OAuthMessage that overrides getAuthorizationHeader to provide the realm value, 
when 
its parameter is null.  This seems awkward.

It would be simple to add a realm property to OAuthMessage.  Would it be better 
to 
get the realm from the OAuthAccessor, OAuthConsumer or OAuthServiceProvider?

Let's continue the conversation via email.  John Kristian 
<jkristian@netflix.com>

Original comment by jmkrist...@gmail.com on 26 Nov 2008 at 11:00

GoogleCodeExporter commented 9 years ago

Original comment by jmkrist...@gmail.com on 26 Nov 2008 at 11:07