From a8c273f85b7aaa89f35c6bbffd76e4a592b62e16 Mon Sep 17 00:00:00 2001 From: Jose Castro Leon Date: Tue, 12 Jul 2016 07:49:26 +0200 Subject: [PATCH] Not authorized when logout and creating instance Add TOKEN_DELETE_DISABLED to the settings so when can customize the revocation of tokens on user logout or switch. This solves an issue when a user launches a long running operation and then logs off resulting in an error if the operation tries to validate the token Change-Id: Ic693c563e028081d87b6447b95ac94608da2dafb Closes-Bug: 1599870 --- openstack_auth/utils.py | 4 ++++ openstack_auth/views.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/openstack_auth/utils.py b/openstack_auth/utils.py index 719cf50..eca6389 100644 --- a/openstack_auth/utils.py +++ b/openstack_auth/utils.py @@ -143,6 +143,10 @@ def get_keystone_client(): return client_v3 +def is_token_deletion_disabled(): + return getattr(settings, 'TOKEN_DELETION_DISABLED', False) + + def is_websso_enabled(): """Websso is supported in Keystone version 3.""" websso_enabled = getattr(settings, 'WEBSSO_ENABLED', False) diff --git a/openstack_auth/views.py b/openstack_auth/views.py index 48b284f..0440384 100644 --- a/openstack_auth/views.py +++ b/openstack_auth/views.py @@ -178,6 +178,8 @@ def logout(request, login_url=None, **kwargs): def delete_token(endpoint, token_id): """Delete a token.""" + if utils.is_token_deletion_disabled(): + return try: endpoint, __ = utils.fix_auth_url_version_prefix(endpoint)