django-oidc-provider/oidc_provider/settings.py

30 lines
628 B
Python
Raw Normal View History

from django.conf import settings
2015-02-18 18:07:22 +00:00
from oidc_provider.lib.claims import AbstractScopeClaims
# Here goes all the package default settings.
default_settings = {
2015-01-30 20:20:36 +00:00
# Required.
'LOGIN_URL': None,
'SITE_URL': None,
2015-01-30 20:20:36 +00:00
# Optional.
'DOP_CODE_EXPIRE': 60*10,
'DOP_EXTRA_SCOPE_CLAIMS': AbstractScopeClaims,
'DOP_IDTOKEN_EXPIRE': 60*10,
'DOP_TOKEN_EXPIRE': 60*60,
}
def get(name):
'''
Helper function to use inside the package.
'''
try:
value = default_settings[name]
value = getattr(settings, name)
except AttributeError:
if value == None:
raise Exception('You must set ' + name + ' in your settings.')
return value