From: Alex Kamedov Date: Wed, 27 Apr 2011 15:52:30 +0000 (+0600) Subject: add CAS_AUTO_REDIRECT_AFTER_LOGOUT settings option X-Git-Tag: 22.4~32^2~18^2 X-Git-Url: https://git.mdrn.pl/django-cas-provider.git/commitdiff_plain/bb0f2e097212e1213fe2dc3661e3da63cc5cbe16 add CAS_AUTO_REDIRECT_AFTER_LOGOUT settings option --- 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)