40 lines
1.3 KiB
Python
40 lines
1.3 KiB
Python
# django-kerberos - SPNEGO/Kerberos authentication for Django applications
|
|
# Copyright (C) 2014-2019 Entr'ouvert
|
|
#
|
|
# This program is free software: you can redistribute it and/or modify it
|
|
# under the terms of the GNU Affero General Public License as published
|
|
# by the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# 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 Affero General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU Affero General Public License
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import sys
|
|
|
|
|
|
class AppSettings(object):
|
|
__PREFIX = 'KERBEROS_'
|
|
__DEFAULTS = {
|
|
'BACKEND_CREATE': False,
|
|
'BACKEND_ADMIN_REGEXP': None,
|
|
'DEFAULT_REALM': None,
|
|
'SERVICE_PRINCIPAL': '',
|
|
'HOSTNAME': None,
|
|
'KEEP_PASSWORD': False,
|
|
}
|
|
|
|
def __getattr__(self, name):
|
|
from django.conf import settings
|
|
if name not in self.__DEFAULTS:
|
|
raise AttributeError
|
|
return getattr(settings, self.__PREFIX + name, self.__DEFAULTS[name])
|
|
|
|
app_settings = AppSettings()
|
|
app_settings.__name__ = __name__
|
|
sys.modules[__name__] = app_settings
|