From bb0f2e097212e1213fe2dc3661e3da63cc5cbe16 Mon Sep 17 00:00:00 2001 From: Alex Kamedov Date: Wed, 27 Apr 2011 21:52:30 +0600 Subject: [PATCH] add CAS_AUTO_REDIRECT_AFTER_LOGOUT settings option --- README.rst | 4 ++++ cas_provider/__init__.py | 1 + cas_provider/views.py | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 9e922c6..8bbe307 100644 --- a/README.rst +++ b/README.rst @@ -42,6 +42,10 @@ used to format custom user attributes. This package provide module `attribute_fo with formatters for common used formats. Available formats styles are `RubyCAS`, `Jasig` and `Name-Value. Default is Jasig style. See module source code for more details. +CAS_AUTO_REDIRECT_AFTER_LOGOUT - If False (default behavior, specified in CAS protocol) +after successful logout notification page will be shown. If it's True, after successful logout will +be auto redirect back to service without any notification. + PROTOCOL DOCUMENTATION ===================== diff --git a/cas_provider/__init__.py b/cas_provider/__init__.py index 449c7b6..d5a3520 100644 --- a/cas_provider/__init__.py +++ b/cas_provider/__init__.py @@ -6,6 +6,7 @@ _DEFAULTS = { 'CAS_TICKET_EXPIRATION': 5, # In minutes 'CAS_CUSTOM_ATTRIBUTES_CALLBACK': None, 'CAS_CUSTOM_ATTRIBUTES_FORMATER': 'cas_provider.attribute_formatters.jasig', + 'CAS_AUTO_REDIRECT_AFTER_LOGOUT': False, } for key, value in _DEFAULTS.iteritems(): diff --git a/cas_provider/views.py b/cas_provider/views.py index d738dcd..c9a44db 100644 --- a/cas_provider/views.py +++ b/cas_provider/views.py @@ -79,7 +79,8 @@ def validate(request): return HttpResponse("no\n\n") -def logout(request, template_name='cas/logout.html', auto_redirect=False): +def logout(request, template_name='cas/logout.html', \ + auto_redirect=settings.CAS_AUTO_REDIRECT_AFTER_LOGOUT): url = request.GET.get('url', None) if request.user.is_authenticated(): auth_logout(request) -- 2.20.1