properly support deprecated Authorization: Token xyz

This commit is contained in:
Ryan Petrello
2018-09-20 15:14:33 -04:00
parent 9fc4c03e5b
commit 23d4122574
2 changed files with 12 additions and 0 deletions

View File

@@ -257,6 +257,9 @@ class DeprecatedAuthTokenMiddleware(object):
'be replaced with OAuth2.0 in the next version of Ansible Tower '
'(see /api/o/ for more details).'
)
elif request.environ.get('HTTP_AUTHORIZATION', '').startswith('Token '):
token = request.environ['HTTP_AUTHORIZATION'].split(' ', 1)[-1].strip()
request.environ['HTTP_AUTHORIZATION'] = six.text_type('Bearer {}').format(token)
class MigrationRanCheckMiddleware(object):