diff options
author | Ryan Petrello <rpetrell@redhat.com> | 2020-08-19 18:21:32 +0200 |
---|---|---|
committer | Ryan Petrello <rpetrell@redhat.com> | 2020-08-19 18:23:00 +0200 |
commit | 815d691622c612153b62f6c23d35b2d682f62a0f (patch) | |
tree | 7c8f3f431081001306bb6ffffa5d46746012c1ca /awxkit | |
parent | Merge pull request #7933 from jakemcdermott/fix-7756 (diff) | |
download | awx-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.py | 7 | ||||
-rw-r--r-- | awxkit/awxkit/awx/utils.py | 2 | ||||
-rwxr-xr-x | awxkit/awxkit/cli/client.py | 2 |
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 |