2015-05-27 20:10:06 +00:00
|
|
|
# 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
|
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License version 3 for
|
|
|
|
# more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License version 3
|
|
|
|
# along with this program; if not, write to the Free Software Foundation, Inc., 51
|
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
#
|
|
|
|
# (c) 2015 Valentin Samir
|
2015-05-27 19:56:39 +00:00
|
|
|
"""Default values for the app's settings"""
|
2015-05-16 21:43:46 +00:00
|
|
|
from django.conf import settings
|
|
|
|
|
2015-06-12 16:10:52 +00:00
|
|
|
|
2015-05-16 21:43:46 +00:00
|
|
|
def setting_default(name, default_value):
|
2015-05-27 19:56:39 +00:00
|
|
|
"""if the config `name` is not set, set it the `default_value`"""
|
2015-05-16 21:43:46 +00:00
|
|
|
value = getattr(settings, name, default_value)
|
|
|
|
setattr(settings, name, value)
|
|
|
|
|
|
|
|
setting_default('CAS_LOGIN_TEMPLATE', 'cas_server/login.html')
|
|
|
|
setting_default('CAS_WARN_TEMPLATE', 'cas_server/warn.html')
|
|
|
|
setting_default('CAS_LOGGED_TEMPLATE', 'cas_server/logged.html')
|
2015-06-02 19:06:32 +00:00
|
|
|
setting_default('CAS_LOGOUT_TEMPLATE', 'cas_server/logout.html')
|
2015-05-30 17:45:59 +00:00
|
|
|
setting_default('CAS_AUTH_CLASS', 'cas_server.auth.DjangoAuthUser')
|
2015-06-05 13:44:17 +00:00
|
|
|
# All CAS implementation MUST support ST and PT up to 32 chars,
|
|
|
|
# PGT and PGTIOU up to 64 chars and it is RECOMMENDED that all
|
|
|
|
# tickets up to 256 chars are supports so we use 64 for the default
|
|
|
|
# len.
|
|
|
|
setting_default('CAS_TICKET_LEN', 64)
|
|
|
|
|
|
|
|
setting_default('CAS_LT_LEN', settings.CAS_TICKET_LEN)
|
|
|
|
setting_default('CAS_ST_LEN', settings.CAS_TICKET_LEN)
|
|
|
|
setting_default('CAS_PT_LEN', settings.CAS_TICKET_LEN)
|
|
|
|
setting_default('CAS_PGT_LEN', settings.CAS_TICKET_LEN)
|
|
|
|
setting_default('CAS_PGTIOU_LEN', settings.CAS_TICKET_LEN)
|
|
|
|
|
2015-06-08 00:51:22 +00:00
|
|
|
setting_default('CAS_TICKET_VALIDITY', 60)
|
|
|
|
setting_default('CAS_PGT_VALIDITY', 3600)
|
2015-05-28 15:30:27 +00:00
|
|
|
setting_default('CAS_TICKET_TIMEOUT', 24*3600)
|
2015-05-16 21:43:46 +00:00
|
|
|
setting_default('CAS_PROXY_CA_CERTIFICATE_PATH', True)
|
2015-06-02 19:06:32 +00:00
|
|
|
setting_default('CAS_REDIRECT_TO_LOGIN_AFTER_LOGOUT', False)
|
2015-05-17 21:24:41 +00:00
|
|
|
|
2015-06-03 16:32:15 +00:00
|
|
|
setting_default('CAS_AUTH_SHARED_SECRET', '')
|
|
|
|
|
2015-06-05 13:44:17 +00:00
|
|
|
setting_default('CAS_LOGIN_TICKET_PREFIX', 'LT')
|
|
|
|
# Service tickets MUST begin with the characters ST so you should not change this
|
|
|
|
# Services MUST be able to accept service tickets of up to 32 characters in length
|
2015-05-29 17:27:54 +00:00
|
|
|
setting_default('CAS_SERVICE_TICKET_PREFIX', 'ST')
|
2015-06-05 13:44:17 +00:00
|
|
|
# Proxy tickets SHOULD begin with the characters, PT.
|
|
|
|
# Back-end services MUST be able to accept proxy tickets of up to 32 characters.
|
2015-05-29 17:27:54 +00:00
|
|
|
setting_default('CAS_PROXY_TICKET_PREFIX', 'PT')
|
2015-06-05 13:44:17 +00:00
|
|
|
# Proxy-granting tickets SHOULD begin with the characters PGT
|
|
|
|
# Services MUST be able to handle proxy-granting tickets of up to 64
|
2015-05-29 17:27:54 +00:00
|
|
|
setting_default('CAS_PROXY_GRANTING_TICKET_PREFIX', 'PGT')
|
2015-06-05 13:44:17 +00:00
|
|
|
# Proxy-granting ticket IOUs SHOULD begin with the characters, PGTIOU
|
|
|
|
# Services MUST be able to handle PGTIOUs of up to 64 characters in length.
|
2015-05-29 17:27:54 +00:00
|
|
|
setting_default('CAS_PROXY_GRANTING_TICKET_IOU_PREFIX', 'PGTIOU')
|
|
|
|
|
2015-12-12 11:01:57 +00:00
|
|
|
# Maximum number of parallel single log out requests send
|
|
|
|
# if more requests need to be send, there are queued
|
|
|
|
setting_default('CAS_SLO_MAX_PARALLEL_REQUESTS', 10)
|
2015-12-13 12:50:01 +00:00
|
|
|
# SLO request timeout.
|
|
|
|
setting_default('CAS_SLO_TIMEOUT', 5)
|
2015-12-12 11:01:57 +00:00
|
|
|
|
2015-05-17 21:24:41 +00:00
|
|
|
setting_default('CAS_SQL_HOST', 'localhost')
|
|
|
|
setting_default('CAS_SQL_USERNAME', '')
|
|
|
|
setting_default('CAS_SQL_PASSWORD', '')
|
|
|
|
setting_default('CAS_SQL_DBNAME', '')
|
|
|
|
setting_default('CAS_SQL_DBCHARSET', 'utf8')
|
2015-06-12 16:10:52 +00:00
|
|
|
setting_default('CAS_SQL_USER_QUERY', 'SELECT user AS usersame, pass AS '
|
|
|
|
'password, users.* FROM users WHERE user = %s')
|
|
|
|
setting_default('CAS_SQL_PASSWORD_CHECK', 'crypt') # crypt or plain
|