refresh_user: add handler parameter

The current request handler might be needed to determine if the auth
data needs to be refreshed.

Signed-off-by: Alejandro del Castillo <alejandro.delcastillo@ni.com>
This commit is contained in:
Alejandro del Castillo
2018-11-13 16:02:55 -06:00
parent 767dce29f4
commit df98fb012e
2 changed files with 3 additions and 2 deletions

View File

@@ -307,7 +307,7 @@ class Authenticator(LoggingConfigurable):
self.log.warning("User %r not in whitelist.", username)
return
async def refresh_user(self, user):
async def refresh_user(self, user, handler=None):
"""Refresh auth data for a given user
Allows refreshing or invalidating auth data.
@@ -319,6 +319,7 @@ class Authenticator(LoggingConfigurable):
Args:
user (User): the user to refresh
handler (tornado.web.RequestHandler or None): the current request handler
Returns:
auth_data (bool or dict):
Return **True** if auth data for the user is up-to-date

View File

@@ -262,7 +262,7 @@ class BaseHandler(RequestHandler):
self._refreshed_users.add(user.name)
self.log.debug("Refreshing auth for %s", user.name)
auth_info = await self.authenticator.refresh_user(user)
auth_info = await self.authenticator.refresh_user(user, self)
if not auth_info:
self.log.warning(