From ff2df817a3bbe5274c4998955aa27310a5816da2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Gr=C3=B6ger?= Date: Wed, 26 Feb 2020 23:03:02 +0100 Subject: [PATCH] finished ##179 --- geruecht/__init__.py | 8 ++++---- geruecht/configparser.py | 3 +++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/geruecht/__init__.py b/geruecht/__init__.py index 0963dd8..ed985cc 100644 --- a/geruecht/__init__.py +++ b/geruecht/__init__.py @@ -5,7 +5,7 @@ """ from .logger import getLogger -from geruecht.controller import dbConfig +from geruecht.controller import dbConfig, ldapConfig from flask_mysqldb import MySQL from flask_ldapconn import LDAPConn @@ -24,9 +24,9 @@ app.config['MYSQL_USER'] = dbConfig['user'] app.config['MYSQL_PASSWORD'] = dbConfig['passwd'] app.config['MYSQL_DB'] = dbConfig['database'] app.config['MYSQL_CURSORCLASS'] = 'DictCursor' -app.config['LDAP_SERVER'] = '192.168.5.128' -app.config['LDAP_PORT'] = 389 -app.config['LDAP_BINDDN'] = 'dc=ldap,dc=example,dc=local' +app.config['LDAP_SERVER'] = ldapConfig['URL'] +app.config['LDAP_PORT'] = ldapConfig['port'] +app.config['LDAP_BINDDN'] = ldapConfig['dn'] app.config['LDAP_USE_TLS'] = False app.config['FORCE_ATTRIBUTE_VALUE_AS_LIST'] = True diff --git a/geruecht/configparser.py b/geruecht/configparser.py index dc519a0..5e98271 100644 --- a/geruecht/configparser.py +++ b/geruecht/configparser.py @@ -33,6 +33,9 @@ class ConifgParser(): self.__error__('Wrong Configuration for LDAP. You should configure ldapconfig with "URL" and "dn"') if 'URL' not in self.config['LDAP'] or 'dn' not in self.config['LDAP']: self.__error__('Wrong Configuration for LDAP. You should configure ldapconfig with "URL" and "dn"') + if 'port' not in self.config['LDAP']: + LOGGER.info('No Config for port in LDAP found. Set it to default: {}'.format(389)) + self.config['LDAP']['port'] = 389 self.ldap = self.config['LDAP'] LOGGER.info("Set LDAPconfig: {}".format(self.ldap)) if 'AccessTokenLifeTime' in self.config: