Add "remember my identity provider" expiry time in a setting parameter
This commit is contained in:
parent
bec51755fa
commit
3a71cc2cca
3 changed files with 5 additions and 1 deletions
|
@ -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:
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue