summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Castro Leon <jose.castro.leon@cern.ch>2016-07-12 07:49:26 +0200
committerJose Castro Leon <jose.castro.leon@cern.ch>2016-07-12 09:03:47 +0200
commita8c273f85b7aaa89f35c6bbffd76e4a592b62e16 (patch)
tree8025b0cfc0a1ef105e2a2c4f03c213d11dd1c6aa
parent0afe75fabc4b3a1c9e9482099fad220008370167 (diff)
downloaddjango_openstack_auth-a8c273f85b7aaa89f35c6bbffd76e4a592b62e16.tar.gz
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
-rw-r--r--openstack_auth/utils.py4
-rw-r--r--openstack_auth/views.py2
2 files changed, 6 insertions, 0 deletions
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)