Commit 0ad79ebf by Brodie Rao

Added CAS_EXTRA_LOGIN_PARAMS setting

parent e9c531b0
= Release Notes =
== Version 2.0.3 ==
* Added `CAS_EXTRA_LOGIN_PARAMS` setting (patched contributed by frasern).
== Version 2.0.2 ==
* Added support for Django 1.0.
......
......@@ -47,6 +47,8 @@ Optional settings include:
* `CAS_ADMIN_PREFIX`: The URL prefix of the Django administration site.
If undefined, the CAS middleware will check the view being rendered to
see if it lives in `django.contrib.admin.views`.
* `CAS_EXTRA_LOGIN_PARAMS`: Extra URL parameters to add to the login URL
when redirecting the user.
* `CAS_IGNORE_REFERER`: If `True`, logging out of the application will
always send the user to the URL specified by `CAS_REDIRECT_URL`.
* `CAS_LOGOUT_COMPLETELY`: If `False`, logging out of the application
......
......@@ -6,6 +6,7 @@ __all__ = []
_DEFAULTS = {
'CAS_ADMIN_PREFIX': None,
'CAS_EXTRA_LOGIN_PARAMS': None,
'CAS_IGNORE_REFERER': False,
'CAS_LOGOUT_COMPLETELY': True,
'CAS_REDIRECT_URL': '/',
......
......@@ -46,6 +46,8 @@ def _login_url(service):
"""Generates CAS login URL"""
params = {'service': service}
if settings.CAS_EXTRA_LOGIN_PARAMS:
params.update(settings.CAS_EXTRA_LOGIN_PARAMS)
url = urljoin(settings.CAS_SERVER_URL, 'login') + '?' + urlencode(params)
return url
......
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