diff options
Diffstat (limited to 'keystone-moon/keystone/models')
-rw-r--r-- | keystone-moon/keystone/models/token_model.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/keystone-moon/keystone/models/token_model.py b/keystone-moon/keystone/models/token_model.py index 3be22b96..2032fd19 100644 --- a/keystone-moon/keystone/models/token_model.py +++ b/keystone-moon/keystone/models/token_model.py @@ -17,7 +17,7 @@ from oslo_config import cfg from oslo_utils import timeutils import six -from keystone.contrib import federation +from keystone.contrib.federation import constants as federation_constants from keystone import exception from keystone.i18n import _ @@ -296,7 +296,8 @@ class KeystoneToken(dict): @property def is_federated_user(self): try: - return self.version is V3 and federation.FEDERATION in self['user'] + return (self.version is V3 and + federation_constants.FEDERATION in self['user']) except KeyError: raise exception.UnexpectedError() @@ -305,7 +306,7 @@ class KeystoneToken(dict): if self.is_federated_user: if self.version is V3: try: - groups = self['user'][federation.FEDERATION].get( + groups = self['user'][federation_constants.FEDERATION].get( 'groups', []) return [g['id'] for g in groups] except KeyError: @@ -316,12 +317,15 @@ class KeystoneToken(dict): def federation_idp_id(self): if self.version is not V3 or not self.is_federated_user: return None - return self['user'][federation.FEDERATION]['identity_provider']['id'] + return ( + self['user'][federation_constants.FEDERATION] + ['identity_provider']['id']) @property def federation_protocol_id(self): if self.version is V3 and self.is_federated_user: - return self['user'][federation.FEDERATION]['protocol']['id'] + return (self['user'][federation_constants.FEDERATION]['protocol'] + ['id']) return None @property |