Commit 7e02e5df authored by Sofia Papagiannaki's avatar Sofia Papagiannaki

astakos: Revoke access granted to resource

parent 2559e4de
......@@ -73,6 +73,7 @@ def login(request, user):
def logout(request, *args, **kwargs):
user = request.user
auth_logout(request, *args, **kwargs)
user.delete_online_access_tokens()
logger.info('%s logged out.', user.log_display)
......
......@@ -562,6 +562,7 @@ class AstakosUser(User):
timedelta(hours=astakos_settings.AUTH_TOKEN_DURATION)
if flush_sessions:
self.flush_sessions(current_key)
self.delete_online_access_tokens()
msg = 'Token renewed for %s'
logger.log(astakos_settings.LOGGING_LEVEL, msg, self.log_display)
......@@ -812,6 +813,12 @@ class AstakosUser(User):
return False
return True
def delete_online_access_tokens(self):
offline_tokens = self.token_set.filter(access_token='online')
logger.info('The following access tokens will be deleted: %s',
offline_tokens)
offline_tokens.delete()
class AstakosUserAuthProviderManager(models.Manager):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment