summaryrefslogtreecommitdiff
path: root/keystoneclient/client.py
diff options
context:
space:
mode:
authorDolph Mathews <dolph.mathews@gmail.com>2013-04-30 17:34:14 +0000
committerGerrit Code Review <review@openstack.org>2013-04-30 17:34:14 +0000
commit28dc9b38a735a7c7d1c59ff82e39ec8e67965e1d (patch)
treee579c419bbd8163627dfc2db74124598e82dbd01 /keystoneclient/client.py
parent22228f526d6ea08b7006be1287afe959b93c23db (diff)
downloadpython-keystoneclient-28dc9b38a735a7c7d1c59ff82e39ec8e67965e1d.tar.gz
Revert "Use TokenManager to get token"
This reverts commit 22228f526d6ea08b7006be1287afe959b93c23db which appears to be breaking the keystone gating
Diffstat (limited to 'keystoneclient/client.py')
-rw-r--r--keystoneclient/client.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/keystoneclient/client.py b/keystoneclient/client.py
index 46ec25d..e3c2ed5 100644
--- a/keystoneclient/client.py
+++ b/keystoneclient/client.py
@@ -144,7 +144,7 @@ class HTTPClient(object):
del self.auth_token_from_user
def authenticate(self, username=None, password=None, tenant_name=None,
- tenant_id=None, token=None):
+ tenant_id=None, auth_url=None, token=None):
""" Authenticate user.
Uses the data provided at instantiation to authenticate against
@@ -177,6 +177,7 @@ class HTTPClient(object):
* if force_new_token is true
"""
+ auth_url = auth_url or self.auth_url
username = username or self.username
password = password or self.password
tenant_name = tenant_name or self.tenant_name
@@ -188,7 +189,7 @@ class HTTPClient(object):
and not self.auth_ref.will_expire_soon(self.stale_duration)):
token = self.auth_ref.auth_token
- (keyring_key, auth_ref) = self.get_auth_ref_from_keyring(self.auth_url,
+ (keyring_key, auth_ref) = self.get_auth_ref_from_keyring(auth_url,
username,
tenant_name,
tenant_id,
@@ -196,7 +197,8 @@ class HTTPClient(object):
new_token_needed = False
if auth_ref is None or self.force_new_token:
new_token_needed = True
- raw_token = self.get_raw_token_from_identity_service(username,
+ raw_token = self.get_raw_token_from_identity_service(auth_url,
+ username,
password,
tenant_name,
tenant_id,
@@ -400,11 +402,8 @@ class HTTPClient(object):
url_to_use = self.management_url
kwargs.setdefault('headers', {})
- if (self.auth_ref
- and not self.auth_ref.will_expire_soon(self.stale_duration)):
- kwargs['headers']['X-Auth-Token'] = self.auth_ref.auth_token
- elif self.auth_token_from_user:
- kwargs['headers']['X-Auth-Token'] = self.auth_token_from_user
+ if self.auth_token:
+ kwargs['headers']['X-Auth-Token'] = self.auth_token
resp, body = self.request(url_to_use + url, method,
**kwargs)