summaryrefslogtreecommitdiffstats
path: root/awxkit
diff options
context:
space:
mode:
authorRyan Petrello <rpetrell@redhat.com>2020-08-19 18:21:32 +0200
committerRyan Petrello <rpetrell@redhat.com>2020-08-19 18:23:00 +0200
commit815d691622c612153b62f6c23d35b2d682f62a0f (patch)
tree7c8f3f431081001306bb6ffffa5d46746012c1ca /awxkit
parentMerge pull request #7933 from jakemcdermott/fix-7756 (diff)
downloadawx-815d691622c612153b62f6c23d35b2d682f62a0f.tar.xz
awx-815d691622c612153b62f6c23d35b2d682f62a0f.zip
clean up old authtoken support
just use Bearer tokens - those are the only type of tokens we support
Diffstat (limited to 'awxkit')
-rw-r--r--awxkit/awxkit/api/client.py7
-rw-r--r--awxkit/awxkit/awx/utils.py2
-rwxr-xr-xawxkit/awxkit/cli/client.py2
3 files changed, 5 insertions, 6 deletions
diff --git a/awxkit/awxkit/api/client.py b/awxkit/awxkit/api/client.py
index 7844a7fa11..77c71a569b 100644
--- a/awxkit/awxkit/api/client.py
+++ b/awxkit/awxkit/api/client.py
@@ -15,12 +15,11 @@ class ConnectionException(exc.Common):
class Token_Auth(requests.auth.AuthBase):
- def __init__(self, token, auth_type='Token'):
+ def __init__(self, token):
self.token = token
- self.auth_type = auth_type
def __call__(self, request):
- request.headers['Authorization'] = '{0.auth_type} {0.token}'.format(self)
+ request.headers['Authorization'] = 'Bearer {0.token}'.format(self)
return request
@@ -57,7 +56,7 @@ class Connection(object):
else:
self.session.auth = (username, password)
elif token:
- self.session.auth = Token_Auth(token, auth_type=kwargs.get('auth_type', 'Token'))
+ self.session.auth = Token_Auth(token)
else:
self.session.auth = None
diff --git a/awxkit/awxkit/awx/utils.py b/awxkit/awxkit/awx/utils.py
index 2238297b67..d25e555ad6 100644
--- a/awxkit/awxkit/awx/utils.py
+++ b/awxkit/awxkit/awx/utils.py
@@ -90,7 +90,7 @@ def as_user(v, username, password=None):
if session_id:
del connection.session.cookies['sessionid']
if access_token:
- kwargs = dict(token=access_token, auth_type='Bearer')
+ kwargs = dict(token=access_token)
else:
kwargs = connection.get_session_requirements()
else:
diff --git a/awxkit/awxkit/cli/client.py b/awxkit/awxkit/cli/client.py
index 3feded89dc..f14d6df135 100755
--- a/awxkit/awxkit/cli/client.py
+++ b/awxkit/awxkit/cli/client.py
@@ -88,7 +88,7 @@ class CLI(object):
token = self.get_config('token')
if token:
self.root.connection.login(
- None, None, token=token, auth_type='Bearer'
+ None, None, token=token,
)
else:
config.use_sessions = True