diff --git a/keystoneclient/client.py b/keystoneclient/client.py index f017bc892..56fc4e7ec 100644 --- a/keystoneclient/client.py +++ b/keystoneclient/client.py @@ -428,8 +428,29 @@ class HTTPClient(object): def process_token(self): """Extract and process information from the new auth_ref. + And set the relevant authentication information. """ - raise NotImplementedError + # if we got a response without a service catalog, set the local + # list of tenants for introspection, and leave to client user + # to determine what to do. Otherwise, load up the service catalog + if self.auth_ref.project_scoped: + if not self.auth_ref.tenant_id: + raise exceptions.AuthorizationFailure( + "Token didn't provide tenant_id") + if self.management_url is None and self.auth_ref.management_url: + self.management_url = self.auth_ref.management_url[0] + self.project_name = self.auth_ref.tenant_name + self.project_id = self.auth_ref.tenant_id + + if not self.auth_ref.user_id: + raise exceptions.AuthorizationFailure( + "Token didn't provide user_id") + + self.user_id = self.auth_ref.user_id + + self.auth_domain_id = self.auth_ref.domain_id + self.auth_tenant_id = self.auth_ref.tenant_id + self.auth_user_id = self.auth_ref.user_id def get_raw_token_from_identity_service(self, auth_url, username=None, password=None, tenant_name=None, diff --git a/keystoneclient/v2_0/client.py b/keystoneclient/v2_0/client.py index 956a103fb..b3292e29b 100644 --- a/keystoneclient/v2_0/client.py +++ b/keystoneclient/v2_0/client.py @@ -138,33 +138,6 @@ class Client(client.HTTPClient): if self.management_url is None: self.authenticate() - def process_token(self): - """Extract and process information from the new auth_ref. - - And set the relevant authentication information. - """ - # if we got a response without a service catalog, set the local - # list of tenants for introspection, and leave to client user - # to determine what to do. Otherwise, load up the service catalog - if self.auth_ref.project_scoped: - if not self.auth_ref.tenant_id: - raise exceptions.AuthorizationFailure( - "Token didn't provide tenant_id") - if self.management_url is None and self.auth_ref.management_url: - self.management_url = self.auth_ref.management_url[0] - self.project_name = self.auth_ref.tenant_name - self.project_id = self.auth_ref.tenant_id - - if not self.auth_ref.user_id: - raise exceptions.AuthorizationFailure( - "Token didn't provide user_id") - - self.user_id = self.auth_ref.user_id - - self.auth_domain_id = self.auth_ref.domain_id - self.auth_tenant_id = self.auth_ref.tenant_id - self.auth_user_id = self.auth_ref.user_id - def get_raw_token_from_identity_service(self, auth_url, username=None, password=None, tenant_name=None, tenant_id=None, token=None, diff --git a/keystoneclient/v3/client.py b/keystoneclient/v3/client.py index 971e67db8..b4c31c6be 100644 --- a/keystoneclient/v3/client.py +++ b/keystoneclient/v3/client.py @@ -16,7 +16,7 @@ import json import logging from keystoneclient import exceptions -from keystoneclient.v2_0 import client +from keystoneclient import client from keystoneclient.v3 import credentials from keystoneclient.v3 import domains from keystoneclient.v3 import endpoints @@ -31,7 +31,7 @@ from keystoneclient.v3 import users _logger = logging.getLogger(__name__) -class Client(client.Client): +class Client(client.HTTPClient): """Client for the OpenStack Identity API v3. :param string user_id: User ID for authentication. (optional) @@ -98,6 +98,9 @@ class Client(client.Client): self.services = services.ServiceManager(self) self.users = users.UserManager(self) + if self.management_url is None: + self.authenticate() + def serialize(self, entity): return json.dumps(entity, sort_keys=True)