diff --git a/project/base_settings/__init__.py b/project/base_settings/__init__.py new file mode 100644 index 0000000..383ccc0 --- /dev/null +++ b/project/base_settings/__init__.py @@ -0,0 +1,2 @@ +from .auth_settings import * +from .restclients_settings import * diff --git a/project/base_settings.py b/project/base_settings/_common.py similarity index 97% rename from project/base_settings.py rename to project/base_settings/_common.py index e2a1196..fdec5e2 100644 --- a/project/base_settings.py +++ b/project/base_settings/_common.py @@ -6,7 +6,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) -if os.getenv('ENV', 'localdev') == "localdev": +if os.getenv('ENV', 'localdev') == 'localdev': SECRET_KEY = os.getenv('DJANGO_SECRET', get_random_secret_key()) else: SECRET_KEY = os.getenv('DJANGO_SECRET', None) @@ -30,7 +30,6 @@ 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] - AUTHENTICATION_BACKENDS = [ 'django.contrib.auth.backends.RemoteUserBackend', ] @@ -104,7 +103,6 @@ } ] - LOGGING = { 'version': 1, 'disable_existing_loggers': False, @@ -142,6 +140,3 @@ } } } - -from .auth_settings import * -from .restclients_settings import * diff --git a/project/auth_settings.py b/project/base_settings/auth_settings.py similarity index 93% rename from project/auth_settings.py rename to project/base_settings/auth_settings.py index a407ab7..dbcdd77 100644 --- a/project/auth_settings.py +++ b/project/base_settings/auth_settings.py @@ -1,12 +1,10 @@ -from .base_settings import INSTALLED_APPS -from django.urls import reverse_lazy -import os +from ._common import * if os.getenv('AUTH', '').startswith('SAML'): INSTALLED_APPS += ['uw_saml'] - LOGIN_URL = reverse_lazy('saml_login') - LOGOUT_URL = reverse_lazy('saml_logout') + LOGIN_URL = '/saml/login' + LOGOUT_URL = '/saml/logout' SAML_USER_ATTRIBUTE = os.getenv('SAML_USER_ATTRIBUTE', 'uwnetid') SAML_FORCE_AUTHN = os.getenv('SAML_FORCE_AUTHN', False) @@ -45,7 +43,7 @@ 'sp': { 'entityId': os.getenv('SAML_ENTITY_ID', 'https://' + CLUSTER_CNAME + '/saml'), 'assertionConsumerService': { - 'url': 'https://' + CLUSTER_CNAME + reverse_lazy('saml_sso'), + 'url': 'https://' + CLUSTER_CNAME + '/saml/sso', 'binding': 'urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST' }, 'singleLogoutService': { diff --git a/project/restclients_settings.py b/project/base_settings/restclients_settings.py similarity index 99% rename from project/restclients_settings.py rename to project/base_settings/restclients_settings.py index 60b37d8..d0eff36 100644 --- a/project/restclients_settings.py +++ b/project/base_settings/restclients_settings.py @@ -1,4 +1,4 @@ -import os +from ._common import * APPLICATION_CERT_PATH = os.getenv('CERT_PATH', '')