diff options
author | Ruan HE <ruan.he@orange.com> | 2015-09-24 12:58:47 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@172.30.200.206> | 2015-09-24 12:58:47 +0000 |
commit | 49325d99acfadaadfad99c596c4ada6b5ec849de (patch) | |
tree | 8aa122c4edb6f9527651e6c3abf65f416c288c85 /keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py | |
parent | 17682330bc068a964bed3ec1c5d43677c09d6d4f (diff) | |
parent | 0be7a3d4e0647dc0d94a34e4fc2f8c364de46602 (diff) |
Merge "Update code from KeystoneMiddleware Github repository (Master)."
Diffstat (limited to 'keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py')
-rw-r--r-- | keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py b/keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py index 12a8767c..93075c5c 100644 --- a/keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py +++ b/keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py @@ -105,6 +105,13 @@ class _TokenData(object): """ return frozenset(self._stored_auth_ref.role_names or []) + @property + def _log_format(self): + roles = ','.join(self.role_names) + return 'user_id %s, project_id %s, roles %s' % (self.user_id, + self.project_id, + roles) + class UserAuthPlugin(base_identity.BaseIdentityPlugin): """The incoming authentication credentials. @@ -119,8 +126,13 @@ class UserAuthPlugin(base_identity.BaseIdentityPlugin): def __init__(self, user_auth_ref, serv_auth_ref): super(UserAuthPlugin, self).__init__(reauthenticate=False) + + # NOTE(jamielennox): _user_auth_ref and _serv_auth_ref are private + # because this object ends up in the environ that is passed to the + # service, however they are used within auth_token middleware. self._user_auth_ref = user_auth_ref self._serv_auth_ref = serv_auth_ref + self._user_data = None self._serv_data = None @@ -167,3 +179,15 @@ class UserAuthPlugin(base_identity.BaseIdentityPlugin): # calculated by the middleware. reauthenticate=False in __init__ should # ensure that this function is only called on the first access. return self._user_auth_ref + + @property + def _log_format(self): + msg = [] + + if self.has_user_token: + msg.append('user: %s' % self.user._log_format) + + if self.has_service_token: + msg.append('service: %s' % self.service._log_format) + + return ' '.join(msg) |