finished ##179

This commit is contained in:
Tim Gröger 2020-02-26 23:03:02 +01:00
parent 358826e8c4
commit ff2df817a3
2 changed files with 7 additions and 4 deletions

View File

@ -5,7 +5,7 @@
""" """
from .logger import getLogger from .logger import getLogger
from geruecht.controller import dbConfig from geruecht.controller import dbConfig, ldapConfig
from flask_mysqldb import MySQL from flask_mysqldb import MySQL
from flask_ldapconn import LDAPConn from flask_ldapconn import LDAPConn
@ -24,9 +24,9 @@ app.config['MYSQL_USER'] = dbConfig['user']
app.config['MYSQL_PASSWORD'] = dbConfig['passwd'] app.config['MYSQL_PASSWORD'] = dbConfig['passwd']
app.config['MYSQL_DB'] = dbConfig['database'] app.config['MYSQL_DB'] = dbConfig['database']
app.config['MYSQL_CURSORCLASS'] = 'DictCursor' app.config['MYSQL_CURSORCLASS'] = 'DictCursor'
app.config['LDAP_SERVER'] = '192.168.5.128' app.config['LDAP_SERVER'] = ldapConfig['URL']
app.config['LDAP_PORT'] = 389 app.config['LDAP_PORT'] = ldapConfig['port']
app.config['LDAP_BINDDN'] = 'dc=ldap,dc=example,dc=local' app.config['LDAP_BINDDN'] = ldapConfig['dn']
app.config['LDAP_USE_TLS'] = False app.config['LDAP_USE_TLS'] = False
app.config['FORCE_ATTRIBUTE_VALUE_AS_LIST'] = True app.config['FORCE_ATTRIBUTE_VALUE_AS_LIST'] = True

View File

@ -33,6 +33,9 @@ class ConifgParser():
self.__error__('Wrong Configuration for LDAP. You should configure ldapconfig with "URL" and "dn"') 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']: 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"') 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'] self.ldap = self.config['LDAP']
LOGGER.info("Set LDAPconfig: {}".format(self.ldap)) LOGGER.info("Set LDAPconfig: {}".format(self.ldap))
if 'AccessTokenLifeTime' in self.config: if 'AccessTokenLifeTime' in self.config: