AC-654 Add API support for token auth using X-Auth-Token header in addition to AUthorization header, fixes issue where API requests from the UI are picking up the basic auth from an API session.

This commit is contained in:
Chris Church
2013-11-19 23:22:30 -05:00
parent 52c0a93293
commit e4851c6e18
5 changed files with 75 additions and 26 deletions

View File

@@ -85,7 +85,12 @@ class APIView(views.APIView):
continue
if resp_hdr.split()[0] and resp_hdr.split()[0] == req_hdr.split()[0]:
return resp_hdr
return super(APIView, self).get_authenticate_header(request)
# If it can't be determined from the request, use the last
# authenticator (should be Basic).
try:
return authenticator.authenticate_header(request)
except NameError:
pass
def get_description_context(self):
return {