Commits

Brodie Rao committed 344c4f4

Added CAS_EXTRA_LOGIN_PARAMS setting

Comments (0)

Files changed (4)

 = 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.
     * `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

django_cas/__init__.py

 
 _DEFAULTS = {
     'CAS_ADMIN_PREFIX': None,
+    'CAS_EXTRA_LOGIN_PARAMS': None,
     'CAS_IGNORE_REFERER': False,
     'CAS_LOGOUT_COMPLETELY': True,
     'CAS_REDIRECT_URL': '/',

django_cas/views.py

     """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