Skip to content
Snippets Groups Projects
Commit 2bbd05d8 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

TMSS-139: minor tweaks

parent 0e6a32c7
No related branches found
No related tags found
1 merge request!96Resolve TMSS-139
...@@ -13,13 +13,17 @@ https://docs.djangoproject.com/en/2.0/ref/settings/ ...@@ -13,13 +13,17 @@ https://docs.djangoproject.com/en/2.0/ref/settings/
import os import os
import ldap import ldap
import logging import logging
from lofar.common import dbcredentials from lofar.common import dbcredentials, isDevelopmentEnvironment
# logger # logger
logger = logging.getLogger('django_auth_ldap') logger = logging.getLogger(__name__)
logger.addHandler(logging.StreamHandler())
logger.setLevel(logging.INFO)
# fix/setup django_auth_ldap logging
logging.getLogger('django_auth_ldap').addHandler(logging.StreamHandler())
logging.getLogger('django_auth_ldap').setLevel(logging.INFO)
# from pprint import pprint
# pprint(dict(os.environ))
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
...@@ -159,7 +163,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = { ldap.OPT_X_TLS_REQUIRE_CERT : ldap.OPT_X_TLS_NE ...@@ -159,7 +163,7 @@ AUTH_LDAP_CONNECTION_OPTIONS = { ldap.OPT_X_TLS_REQUIRE_CERT : ldap.OPT_X_TLS_NE
# AUTH_LDAP_BIND_DN = '' # our LDAP is open # AUTH_LDAP_BIND_DN = '' # our LDAP is open
# AUTH_LDAP_BIND_PASSWORD = '' # our LDAP is open # AUTH_LDAP_BIND_PASSWORD = '' # our LDAP is open
protocol = 'ldaps://' protocol = 'ldaps://'
if 'test' in ldap_creds_name: if isDevelopmentEnvironment():
logging.warning('Test ldap credentials detected, using insecure connection for ldap autenthication') # mock LDAP does not support ldaps:// logging.warning('Test ldap credentials detected, using insecure connection for ldap autenthication') # mock LDAP does not support ldaps://
protocol = 'ldap://' protocol = 'ldap://'
AUTH_LDAP_SERVER_URI = "%s%s:%s" % (protocol, django_ldap_credentials.host, django_ldap_credentials.port) AUTH_LDAP_SERVER_URI = "%s%s:%s" % (protocol, django_ldap_credentials.host, django_ldap_credentials.port)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment