--
You received this message because you are subscribed to the Google Groups "Signpost users" group.
To post to this group, send email to signpos...@googlegroups.com.
To unsubscribe from this group, send email to signpost-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/signpost-users?hl=en.
To unsubscribe from this group, send email to signpost-user...@googlegroups.com.
At a second glance, I see a couple issues with your code. First,
QueryStringSigningStrategy, you cannot use that to sign requests. Or
to quote from that class' documentation: ;-)
"Writes to a URL query string. Note that this currently ONLY works
when signing a URL directly, not with HTTP request objects."
so, you can use it to "sign" a URI string to produce clickable, signed
URLs, but it doesn't work on an existing request object
that's because often you cannot change the URI for a request object
that has already been created (Apache commons HTTP requests don't
allow that for instance). I think there's a ticket to create a
workaround for this, but currently just don't use it unless you're
creating a signed URL.
that being said, what you could do is use Signpost to the sign the URL
first, then use that signed URL to create your request object (and
don't sign that again).
Just curious, why do you want to use the URL to carry the signature?
That's a pretty uncommon thing to do, just use the HTTP Authorization
header (which is the default) and you wouldn't even run into this
problem.
Another remark: You can remove the call to setMessageSigner().
HMAC-SHA1 is the default.
Yet another remark: I believe your code is still wrong even when
changing the above things, since you seem to sign the request /before/
adding more parameters to it (using the UrlEncodedFormEntity), or am I
misunderstanding that? The OAuth signature must contain ALL request
parameters, otherwise authentication will fail.
Does that make sense?
Cheers,
Matthias
2010/6/16 Paddy Foran <foran...@gmail.com>:
--
PLEASE NOTE OUR NEW ADDRESS!
-------------------------------------------------------
Matthias Käppler
Software Developer
Qype GmbH
Großer Burstah 50-52
20457 Hamburg
Telephone: +49 (0)40 - 219 019 2 - 260
Skype: m_kaeppler
Email: matt...@qype.com
Managing Director: Ian Brotherston
Amtsgericht Hamburg
HRB 95913
This e-mail and its attachments may contain confidential and/or
privileged information. If you are not the intended recipient (or have
received this e-mail in error) please notify the sender immediately
and destroy this e-mail and its attachments. Any unauthorized copying,
disclosure or distribution of this e-mail and its attachments is
strictly forbidden. This notice also applies to future messages.
consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
String access_token = settings.getString("token", "error");
String access_secret = settings.getString("secret", "error");
consumer.setTokenWithSecret(access_token, access_secret);
DefaultHttpClient httpClient = new DefaultHttpClient();
// replace the POST entity stuff with a simple URL query string
String target = OAuth.addQueryParameters(host + "/links/add", "link", url);
// sign the above URL
consumer.setSigningStrategy(new QueryStringSigningStrategy());
target = consumer.sign(target)
// send the request
HttpPost request = new HttpPost(target);
httpClient.execute(request)
this will carry all parameters in the URL, but the app server probably
won't care.
HTH,
2010/6/16 Paddy Foran <foran...@gmail.com>:
2010/6/16 Paddy Foran <foran...@gmail.com>:
cheers,
2010/6/16 Paddy Foran <foran...@gmail.com>:
But what you can try is doing it in program code, before running any
Signpost code:
System.setProperty("debug", true);
I didn't actually try that, but it should do the job.
2010/6/16 Paddy Foran <foran...@gmail.com>:
The client provided OAuth parameters with the request, but they are invalid.
2010/6/16 Paddy Foran <foran...@gmail.com>: