def __init__(self, *args, **kw): """ base controller constructor :param *args: generic argument array :param **kw: generic argument dict :return: None """ self.parent = super(WSGIController, self) self.parent.__init__(*args, **kw) # make the OpenID SQL Instance globally available openid_sql = config.get('openid_sql', None) if openid_sql is None: try: openid_storage = SQLStorage() config['openid_sql'] = openid_storage except Exception as exx: config['openid_sql'] = exx log.error("Failed to configure openid_sql: %r" % exx) app_setup_done = config.get('app_setup_done', False) if app_setup_done is False: try: setup_app(config) config['app_setup_done'] = True except Exception as exx: config['app_setup_done'] = False log.error("Failed to serve request: %r" % exx) raise exx l_config = initLinotpConfig() resolver_setup_done = config.get('resolver_setup_done', False) if resolver_setup_done is False: try: cache_dir = config.get("app_conf", {}).get("cache_dir", None) setupResolvers(config=l_config, cache_dir=cache_dir) config['resolver_setup_done'] = True except Exception as exx: config['resolver_setup_done'] = False log.error("Failed to setup resolver: %r" % exx) raise exx initResolvers() return
def __init__(self, *args, **kw): """ base controller constructor :param *args: generic argument array :param **kw: generic argument dict :return: None """ self.sep = None self.set_language(request.headers) self.base_auth_user = '' self.parent = super(WSGIController, self) self.parent.__init__(*args, **kw) # make the OpenID SQL Instance globally available openid_sql = config.get('openid_sql', None) if openid_sql is None: try: openid_storage = SQLStorage() config['openid_sql'] = openid_storage except Exception as exx: config['openid_sql'] = exx log.error("Failed to configure openid_sql: %r" % exx) app_setup_done = config.get('app_setup_done', False) if app_setup_done is False: try: setup_app(config) config['app_setup_done'] = True except Exception as exx: config['app_setup_done'] = False log.error("Failed to serve request: %r" % exx) raise exx # set the decryption device before loading linotp config, # so it contains the decrypted values as well glo = getGlobalObject() self.sep = glo.security_provider try: hsm = self.sep.getSecurityModule() self.hsm = hsm c.hsm = hsm except Exception as exx: log.exception('failed to assign hsm device: %r' % exx) raise exx l_config = initLinotpConfig() # initialize the elliptic curve secret + public key for the qr token linotpQrTokenSecretKey = l_config.get('QrTokenSecretKey', False) if not linotpQrTokenSecretKey: init_qrtoken_secret_key(l_config) resolver_setup_done = config.get('resolver_setup_done', False) if resolver_setup_done is False: try: cache_dir = config.get("app_conf", {}).get("cache_dir", None) setupResolvers(config=l_config, cache_dir=cache_dir) config['resolver_setup_done'] = True except Exception as exx: config['resolver_setup_done'] = False log.error("Failed to setup resolver: %r" % exx) raise exx return
def __init__(self, *args, **kw): """ base controller constructor :param *args: generic argument array :param **kw: generic argument dict :return: None """ self.sep = None self.parent = super(WSGIController, self) self.parent.__init__(*args, **kw) # make the OpenID SQL Instance globally available openid_sql = config.get('openid_sql', None) if openid_sql is None: try: openid_storage = SQLStorage() config['openid_sql'] = openid_storage except Exception as exx: config['openid_sql'] = exx log.error("Failed to configure openid_sql: %r" % exx) app_setup_done = config.get('app_setup_done', False) if app_setup_done is False: try: setup_app(config) config['app_setup_done'] = True except Exception as exx: config['app_setup_done'] = False log.error("Failed to serve request: %r" % exx) raise exx # set the decryption device before loading linotp config, # so it contains the decrypted values as well glo = getGlobalObject() self.sep = glo.security_provider try: hsm = self.sep.getSecurityModule() c.hsm = hsm except Exception as exx: log.error('failed to assign hsm device: %r' % exx) raise exx l_config = initLinotpConfig() resolver_setup_done = config.get('resolver_setup_done', False) if resolver_setup_done is False: try: cache_dir = config.get("app_conf", {}).get("cache_dir", None) setupResolvers(config=l_config, cache_dir=cache_dir) config['resolver_setup_done'] = True except Exception as exx: config['resolver_setup_done'] = False log.error("Failed to setup resolver: %r" % exx) raise exx initResolvers() return
def __init__(self, *args, **kw): """ base controller constructor :param *args: generic argument array :param **kw: generic argument dict :return: None """ self.sep = None self.set_language(request.headers) self.base_auth_user = '' self.parent = super(WSGIController, self) self.parent.__init__(*args, **kw) # make the OpenID SQL Instance globally available openid_sql = config.get('openid_sql', None) if openid_sql is None: try: openid_storage = SQLStorage() config['openid_sql'] = openid_storage except Exception as exx: config['openid_sql'] = exx log.error("Failed to configure openid_sql: %r" % exx) first_run = False app_setup_done = config.get('app_setup_done', False) if app_setup_done is False: try: setup_app(config) config['app_setup_done'] = True first_run = True except Exception as exx: config['app_setup_done'] = False log.error("Failed to serve request: %r" % exx) raise exx # set the decryption device before loading linotp config, # so it contains the decrypted values as well glo = getGlobalObject() self.sep = glo.security_provider try: hsm = self.sep.getSecurityModule() self.hsm = hsm c.hsm = hsm except Exception as exx: log.exception('failed to assign hsm device: %r' % exx) raise exx l_config = initLinotpConfig() # initialize the elliptic curve secret + public key for the qrtoken secret_key = l_config.get('SecretKey.Partition.0', False) if not secret_key: init_key_partition(l_config, partition=0) resolver_setup_done = config.get('resolver_setup_done', False) if resolver_setup_done is False: try: cache_dir = config.get("app_conf", {}).get("cache_dir", None) setupResolvers(config=l_config, cache_dir=cache_dir) config['resolver_setup_done'] = True except Exception as exx: config['resolver_setup_done'] = False log.error("Failed to setup resolver: %r", exx) raise exx # TODO: verify merge dropped # initResolvers() # if we are in the setup cycle, we check for the linotpLicenseFile if first_run: if "linotpLicenseFile" in config and 'license' not in l_config: license_str = '' filename = config.get("linotpLicenseFile", '') try: with open(filename) as f: license_str = f.read() except IOError: log.error("could not open licence file: %s", filename) if not license_str: log.error("empty license file: %s", filename) else: with request_context_safety(): request_context['translate'] = translate import linotp.lib.support res, msg = linotp.lib.support.setSupportLicense( license_str) if res is False: log.error("failed to load license: %s: %s", license_str, msg) else: log.info("license successfully loaded") return
def __init__(self, *args, **kw): """ base controller constructor :param *args: generic argument array :param **kw: generic argument dict :return: None """ self.sep = None self.set_language(request.headers) self.base_auth_user = '' self.parent = super(WSGIController, self) self.parent.__init__(*args, **kw) # make the OpenID SQL Instance globally available openid_sql = config.get('openid_sql', None) if openid_sql is None: try: openid_storage = SQLStorage() config['openid_sql'] = openid_storage except Exception as exx: config['openid_sql'] = exx log.error("Failed to configure openid_sql: %r" % exx) first_run = False app_setup_done = config.get('app_setup_done', False) if app_setup_done is False: try: setup_app(config) config['app_setup_done'] = True first_run = True except Exception as exx: config['app_setup_done'] = False log.error("Failed to serve request: %r" % exx) raise exx # set the decryption device before loading linotp config, # so it contains the decrypted values as well glo = getGlobalObject() self.sep = glo.security_provider try: hsm = self.sep.getSecurityModule() self.hsm = hsm c.hsm = hsm except Exception as exx: log.exception('failed to assign hsm device: %r' % exx) raise exx l_config = initLinotpConfig() # initialize the elliptic curve secret + public key for the qr token linotpQrTokenSecretKey = l_config.get('QrTokenSecretKey', False) if not linotpQrTokenSecretKey: init_qrtoken_secret_key(l_config) resolver_setup_done = config.get('resolver_setup_done', False) if resolver_setup_done is False: try: cache_dir = config.get("app_conf", {}).get("cache_dir", None) setupResolvers(config=l_config, cache_dir=cache_dir) config['resolver_setup_done'] = True except Exception as exx: config['resolver_setup_done'] = False log.error("Failed to setup resolver: %r" % exx) raise exx # TODO: verify merge dropped # initResolvers() # if we are in the setup cycle, we check for the linotpLicenseFile if first_run: if "linotpLicenseFile" in config and 'license' not in l_config: license_str = '' filename = config.get("linotpLicenseFile", '') try: with open(filename) as f: license_str = f.read() except IOError: log.error("linotpLicenseFile: %s" % filename) if not license_str: log.error("empty license file: %s" % filename) else: with request_context_safety(): request_context['translate'] = translate import linotp.lib.support res, msg = linotp.lib.support.setSupportLicense(license_str) if res is False: log.error("failed to load license: %s: %s" % (license_str, msg)) else: log.info("license successfully loaded") return