aboutsummaryrefslogtreecommitdiffstats
path: root/keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py
diff options
context:
space:
mode:
authorasteroide <thomas.duval@orange.com>2015-09-24 14:39:09 +0200
committerasteroide <thomas.duval@orange.com>2015-09-24 14:39:09 +0200
commit0be7a3d4e0647dc0d94a34e4fc2f8c364de46602 (patch)
tree14214bb0bbf2430b6ee0df387ddbdbf13c4c4d63 /keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py
parente35decd4e989773c96a9abb263257291bd51ae1e (diff)
Update code from KeystoneMiddleware Github repository (Master).
Change-Id: Id28c5bf48b3dbb6c8a08e66411b5785029f6857d
Diffstat (limited to 'keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py')
-rw-r--r--keystonemiddleware-moon/keystonemiddleware/auth_token/_user_plugin.py24
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)