def getSecret(id=0): log.debug('getSecret()') if not env.has_key("linotpSecretFile"): log.error("[getSecret] no secret file defined. A parameter linotpSecretFile is missing in your linotp.ini.") raise Exception("no secret file defined: linotpSecretFile!") secFile = env["linotpSecretFile"] #if True == isWorldAccessible(secFile): # log.error("file permission of the secret file :%s: are not secure!", secFile) # raise Exception("permissions of the secret file are not secure!") secret = '' try: f = open(secFile) for _i in range (0 , id + 1): secret = f.read(32) f.close() if secret == "" : #secret = setupKeyFile(secFile, id+1) raise Exception ("No secret key defined for index: %s !\n" "Please extend your %s !" % (unicode(id), secFile)) except Exception as exx: raise Exception ("Exception: %r" % exx) return secret
def __init__(self, *args, **kwargs): ''' initialize the test class ''' TestCase.__init__(self, *args, **kwargs) LOG.debug("ConfigFile: %s " % config['__file__']) conffile = config['__file__'] if pylons.test.pylonsapp: wsgiapp = pylons.test.pylonsapp else: wsgiapp = loadapp('config: %s' % config['__file__']) self.app = TestApp(wsgiapp) conf = None if conffile.startswith('/'): conf = appconfig('config:%s' % config['__file__'], relative_to=None) else: raise Exception('dont know how to load the application relatively') #conf = appconfig('config: %s' % config['__file__'], relative_to=rel) load_environment(conf.global_conf, conf.local_conf) self.appconf = conf url._push_object(URLGenerator(config['routes.map'], environ)) self.isSelfTest = False if env.has_key("linotp.selfTest"): self.isSelfTest = True return
def __init__(self, *args, **kwargs): ''' initialize the test class ''' TestCase.__init__(self, *args, **kwargs) LOG.error("ConfigFile: %s " % config['__file__']) conffile = config['__file__'] if pylons.test.pylonsapp: wsgiapp = pylons.test.pylonsapp else: wsgiapp = loadapp('config: %s' % config['__file__']) self.app = TestApp(wsgiapp) conf = None if conffile.startswith('/'): conf = appconfig('config:%s' % config['__file__'], relative_to=None) else: raise Exception('dont know how to load the application relatively') #conf = appconfig('config: %s' % config['__file__'], relative_to=rel) load_environment(conf.global_conf, conf.local_conf) self.appconf = conf url._push_object(URLGenerator(config['routes.map'], environ)) self.isSelfTest = False if env.has_key("privacyidea.selfTest"): self.isSelfTest = True self.license = 'CE' return
def getSecret(id=0): log.debug('getSecret()') if not env.has_key("linotpSecretFile"): log.error( "[getSecret] no secret file defined. A parameter linotpSecretFile is missing in your linotp.ini." ) raise Exception("no secret file defined: linotpSecretFile!") secFile = env["linotpSecretFile"] # if True == isWorldAccessible(secFile): # log.error("file permission of the secret file :%s: are not secure!", secFile) # raise Exception("permissions of the secret file are not secure!") secret = '' try: f = open(secFile) for _i in range(0, id + 1): secret = f.read(32) f.close() if secret == "": # secret = setupKeyFile(secFile, id+1) raise Exception("No secret key defined for index: %s !\n" "Please extend your %s !" % (unicode(id), secFile)) except Exception as exx: raise Exception("Exception: %r" % exx) return secret
def getSecret(id=0): if not env.has_key("linotpSecretFile"): log.error("No secret file defined. The parameter linotpSecretFile is " "missing in your linotp.ini") raise Exception("No secret file defined") secFile = env["linotpSecretFile"] secret = '' try: f = open(secFile) for _i in range(0, id + 1): secret = f.read(32) f.close() if secret == "": # secret = setupKeyFile(secFile, id+1) raise Exception("No secret key defined for index: %s !\n" "Please extend your %s !" % (unicode(id), secFile)) except Exception as exx: raise Exception("Exception: %r" % exx) return secret