Add "remember my identity provider" expiry time in a setting parameter

This commit is contained in:
Valentin Samir 2016-06-21 15:41:43 +02:00
parent bec51755fa
commit 3a71cc2cca
3 changed files with 5 additions and 1 deletions

View file

@ -146,6 +146,9 @@ Federation settings:
The default is ``False``.
* ``CAS_FEDERATE_PROVIDERS``: A distionnary for the allowed identity providers (see the federate
section below). The default is ``{}``.
* ``CAS_FEDERATE_REMEMBER_TIMEOUT``: Time after witch the cookie use for "remember my identity
provider" expire. The default is ``604800``, one week. The cookie is called
``_remember_provider``.
Tickets validity settings:

View file

@ -81,6 +81,7 @@ setting_default('CAS_SQL_PASSWORD_CHECK', 'crypt') # crypt or plain
setting_default('CAS_FEDERATE', False)
# A dict of "provider suffix" -> (provider CAS server url, CAS version, verbose name)
setting_default('CAS_FEDERATE_PROVIDERS', {})
setting_default('CAS_FEDERATE_REMEMBER_TIMEOUT', 604800) # one week
if settings.CAS_FEDERATE:
settings.CAS_AUTH_CLASS = "cas_server.auth.CASFederateAuth"

View file

@ -197,7 +197,7 @@ class FederateAuth(View):
)
response = HttpResponseRedirect(url)
if form.cleaned_data["remember"]:
max_age = 7 * 24 * 60 * 60 # one week
max_age = settings.CAS_FEDERATE_REMEMBER_TIMEOUT
utils.set_cookie(response, "_remember_provider", request.POST["provider"], max_age)
return response
else: