On 09/29/2011 04:26 PM, Matt Wagner wrote:
On Thu, Sep 29, 2011 at 04:15:08PM +0200, Jan Provaznik wrote:
>
> Is it necessary to use 'authenticated_' prefix in above methods?
> Common use case will be something like this:
> oauth = OAuthClient.new
> oauth.authenticated_get
> oauth.authenticated_post
It's not necessary, no. I think you're right that it will be perfectly
clear without the "authenticated_" prefix. I'll change this.
>
> It's not possilbe to set default_headers, this would be very handy
> because we will have to send username with each request
I don't understand why you say it is not possible. Do you just mean that
the method shouldn't be private so that we can set them directly? What I
had in mind is that you could implement, say, a Katello client, and in
the client do:
def default_headers
{'katello-user' => 'admin'}
end
But I might have misunderstood you.
Ah, true - I forgot you plan to have classes for iwhd/katello/,,, on top
of this. I meant that when I want to use this lib, there is currently no
way how to pass default_headers, for example something like this:
class OAuthClient
attr_reader :default_headers
def initize(opts)
...
@default_headers = opts[:headers]
end
end
But as there will be classes for each oauth provider (iwhd/katello/,,,)
it can be set there by overriding default_headers as you suggested. So
ignore this :).
> I'm not sure about this host extraction, then it's not
possible to
> use multiple oauth providers on one host. Why not use whole
> "resource" as key?
Good point. I was trying to keep things looking clean in the config
file, but I didn't consider the limit it placed on using more than one
provider per host. I'll change this, too.
> Hi Matt,
> overall looks/works fine, have couple of less important questions inline.
Thanks. If you can clarify/expand what you mean about default_headers,
I'll go ahead and resend with fixes.
-- Matt