On Tue, 4 Oct 2011 21:21:23 -0500
Steve Loranz <sloranz(a)redhat.com> wrote:
(cc: aeolus-devel)
Here's the output I'm getting:
---
Traceback (most recent call last):
File "testWarehouseOauth.py", line 6, in <module>
r, c = client.request('http://chifac2.usersys.redhat.com:9090',
method='GET')
........
File
"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/httplib2/__init__.py",
line 300, in _parse_www_authenticate
raise MalformedHeader("WWW-Authenticate")
httplib2.MalformedHeader: WWW-Authenticate
Mine is similar, perhaps a different version:
[zaitcev@lembas iwhd-tip]$ python t/testoauth.py
Traceback (most recent call last):
File "t/testoauth.py", line 9, in <module>
r, c = client.request('http://localhost:9090', method='GET')
...................
File "/usr/lib/python2.7/site-packages/httplib2/__init__.py", line 254, in
_parse_www_authenticate
(auth_scheme, the_rest) = authenticate.split(" ", 1)
ValueError: need more than 1 value to unpack
I'm not yet sure what oauth2 doesn't like about the
WWW-Authenticate
header in the response. If you have any thoughts on it, I'm all ears.
RFC-5849 says:
Servers MAY indicate their support for the "OAuth" auth-scheme by
returning the HTTP "WWW-Authenticate" response header field upon
client requests for protected resources. As per [RFC2617], such a
response MAY include additional HTTP "WWW-Authenticate" header
fields:
For example:
WWW-Authenticate: OAuth
realm="http://server.example.com/"
It says "MAY include" so, I thought that parameters were optional.
But RFC-2617 says:
auth-scheme = token
auth-param = token "=" ( token | quoted-string )
The 401 (Unauthorized) response message is used by an origin server
to challenge the authorization of a user agent. This response MUST
include a WWW-Authenticate header field containing at least one
challenge applicable to the requested resource. [...]
challenge = auth-scheme 1*SP 1#auth-param
[...]
The authentication parameter realm is defined for all authentication
schemes:
realm = "realm" "=" realm-value
realm-value = quoted-string
The realm directive (case-insensitive) is required for all
authentication schemes that issue a challenge.
So, basically I need to add a realm to the header. This is a little
unfortunate, because now I need to add a way to configure it, too.
Unless we're ok with realm="iwhd" or a hostname of the server, that is.
-- Pete