Add CAS_FEDERATE_PROVIDERS_LIST to settings parameters
This commit is contained in:
parent
3a71cc2cca
commit
4c5599ea7b
@ -144,8 +144,12 @@ Federation settings:
|
|||||||
|
|
||||||
* ``CAS_FEDERATE``: A boolean for activating the federated mode (see the federate section below).
|
* ``CAS_FEDERATE``: A boolean for activating the federated mode (see the federate section below).
|
||||||
The default is ``False``.
|
The default is ``False``.
|
||||||
* ``CAS_FEDERATE_PROVIDERS``: A distionnary for the allowed identity providers (see the federate
|
* ``CAS_FEDERATE_PROVIDERS``: A dictionnary for the allowed identity providers (see the federate
|
||||||
section below). The default is ``{}``.
|
section below). The default is ``{}``.
|
||||||
|
* ``CAS_FEDERATE_PROVIDERS_LIST``: A list in with the keys of ``CAS_FEDERATE_PROVIDERS`` are ordened
|
||||||
|
for beeing displayed on the login page. The default is the list of all the keys of
|
||||||
|
``CAS_FEDERATE_PROVIDERS`` sorted in natural order (0 < 2 < 10 < 20 < a = A < … < z = Z and
|
||||||
|
lexicographical)
|
||||||
* ``CAS_FEDERATE_REMEMBER_TIMEOUT``: Time after witch the cookie use for "remember my identity
|
* ``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
|
provider" expire. The default is ``604800``, one week. The cookie is called
|
||||||
``_remember_provider``.
|
``_remember_provider``.
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
# ⁻*- coding: utf-8 -*-
|
||||||
# This program is distributed in the hope that it will be useful, but WITHOUT
|
# This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
||||||
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
|
||||||
@ -86,9 +87,13 @@ setting_default('CAS_FEDERATE_REMEMBER_TIMEOUT', 604800) # one week
|
|||||||
if settings.CAS_FEDERATE:
|
if settings.CAS_FEDERATE:
|
||||||
settings.CAS_AUTH_CLASS = "cas_server.auth.CASFederateAuth"
|
settings.CAS_AUTH_CLASS = "cas_server.auth.CASFederateAuth"
|
||||||
|
|
||||||
|
# create CAS_FEDERATE_PROVIDERS_LIST default value if not set: list of
|
||||||
|
# the keys of CAS_FEDERATE_PROVIDERS in natural order: 2 < 10 < 20 < a = A < … < z = Z
|
||||||
|
try:
|
||||||
|
getattr(settings, 'CAS_FEDERATE_PROVIDERS_LIST')
|
||||||
|
except AttributeError:
|
||||||
__CAS_FEDERATE_PROVIDERS_LIST = list(settings.CAS_FEDERATE_PROVIDERS.keys())
|
__CAS_FEDERATE_PROVIDERS_LIST = list(settings.CAS_FEDERATE_PROVIDERS.keys())
|
||||||
|
|
||||||
|
|
||||||
def __CAS_FEDERATE_PROVIDERS_LIST_sort(key):
|
def __CAS_FEDERATE_PROVIDERS_LIST_sort(key):
|
||||||
if len(settings.CAS_FEDERATE_PROVIDERS[key]) > 2:
|
if len(settings.CAS_FEDERATE_PROVIDERS[key]) > 2:
|
||||||
key = settings.CAS_FEDERATE_PROVIDERS[key][2].lower()
|
key = settings.CAS_FEDERATE_PROVIDERS[key][2].lower()
|
||||||
@ -101,9 +106,7 @@ def __CAS_FEDERATE_PROVIDERS_LIST_sort(key):
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
|
||||||
__CAS_FEDERATE_PROVIDERS_LIST_sort.tokenize = re.compile(r'(\d+)|(\D+)').findall
|
__CAS_FEDERATE_PROVIDERS_LIST_sort.tokenize = re.compile(r'(\d+)|(\D+)').findall
|
||||||
__CAS_FEDERATE_PROVIDERS_LIST.sort(key=__CAS_FEDERATE_PROVIDERS_LIST_sort)
|
__CAS_FEDERATE_PROVIDERS_LIST.sort(key=__CAS_FEDERATE_PROVIDERS_LIST_sort)
|
||||||
|
|
||||||
settings.CAS_FEDERATE_PROVIDERS_LIST = __CAS_FEDERATE_PROVIDERS_LIST
|
setting_default('CAS_FEDERATE_PROVIDERS_LIST', __CAS_FEDERATE_PROVIDERS_LIST)
|
||||||
|
Loading…
Reference in New Issue
Block a user