Modififed the composite and the client
* Changed the model response to be consistent * Removed duplicate code from v3 composite * Removed dupicate code from v3 config Change-Id: I1f8b55b65128de0baf700dfb8ed89171cb4c5521
This commit is contained in:
parent
25f9ca2d76
commit
44bbe30a10
|
@ -1,7 +1,7 @@
|
|||
import exceptions
|
||||
|
||||
from cloudcafe.identity.common.client import BaseIdentityAPIClient
|
||||
from cloudcafe.identity.v3.common.tokens.models import responses, request
|
||||
from cloudcafe.identity.v3.common.tokens.models import response, request
|
||||
|
||||
|
||||
class ModelNotDefined(exceptions.Exception):
|
||||
|
@ -52,7 +52,7 @@ class TokensClient(BaseIdentityAPIClient):
|
|||
@type requestslib_kwargs: dictionary
|
||||
"""
|
||||
|
||||
response_models = {'default': responses.AuthResponse}
|
||||
response_models = {'default': response.AuthResponse}
|
||||
if response_model.lower() not in response_models.keys():
|
||||
raise ModelNotDefined(model_name=response_model)
|
||||
response_model = response_models[response_model.lower()]
|
||||
|
@ -98,7 +98,7 @@ class TokensClient(BaseIdentityAPIClient):
|
|||
params = {"nocatalog": nocatalog}
|
||||
return self.get(url, params=params,
|
||||
headers={'x-subject-token': token},
|
||||
response_entity_type=responses.AuthResponse,
|
||||
response_entity_type=response.AuthResponse,
|
||||
requestslib_kwargs=requestslib_kwargs)
|
||||
|
||||
def revoke_token(self, token, requestslib_kwargs=None):
|
||||
|
|
|
@ -8,9 +8,6 @@ class IdentityV3Composite(IdentityComposite):
|
|||
def __init__(self, user_config=None):
|
||||
super(IdentityV3Composite, self).__init__(user_config=user_config)
|
||||
self.version = 'v3'
|
||||
self.url = (
|
||||
self.user_config.authentication_endpoint or
|
||||
self.ident_config.global_authentication_endpoint)
|
||||
self.tokens_client = TokensClient(
|
||||
url=self.url,
|
||||
serialize_format=self.ident_config.serialize_format,
|
||||
|
|
|
@ -1,29 +1,6 @@
|
|||
from ast import literal_eval
|
||||
|
||||
from cafe.engine.models.data_interfaces import ConfigSectionInterface
|
||||
|
||||
|
||||
class IdentityV3Config(ConfigSectionInterface):
|
||||
|
||||
SECTION_NAME = 'identity_v3'
|
||||
|
||||
@property
|
||||
def serialize_format(self):
|
||||
return self.get("serialize_format", "json")
|
||||
|
||||
@property
|
||||
def deserialize_format(self):
|
||||
return self.get("deserialize_format", "json")
|
||||
|
||||
@property
|
||||
def global_authentication_endpoint(self):
|
||||
return self.get("global_authentication_endpoint")
|
||||
|
||||
@property
|
||||
def environment(self):
|
||||
return literal_eval(self.get("environment"))
|
||||
|
||||
|
||||
class IdentityUserConfig(ConfigSectionInterface):
|
||||
|
||||
SECTION_NAME = 'Base class do not use'
|
||||
|
|
Loading…
Reference in New Issue