Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/309.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 是烧瓶缓存';文件系统缓存是否安全?_Python_Caching_Flask_Flask Cache - Fatal编程技术网

Python 是烧瓶缓存';文件系统缓存是否安全?

Python 是烧瓶缓存';文件系统缓存是否安全?,python,caching,flask,flask-cache,Python,Caching,Flask,Flask Cache,我想使用cache.memoize decorator缓存身份验证函数的结果 但是,身份验证函数将用户名和密码作为参数,我需要维护安全性 Cache(config={'CACHE_TYPE': 'filesystem'}) @cache.memoize def authenticate(username, password) # some logic return True/False Flask缓存的文件系统缓存安全吗?有没有办法通过模块设置flask缓存文件的所有权/权限

我想使用cache.memoize decorator缓存身份验证函数的结果

但是,身份验证函数将用户名和密码作为参数,我需要维护安全性

Cache(config={'CACHE_TYPE': 'filesystem'})

@cache.memoize
def authenticate(username, password)
    # some logic
    return True/False

Flask缓存的文件系统缓存安全吗?有没有办法通过模块设置flask缓存文件的所有权/权限?

将原始密码存储在任意位置一段时间听起来不是个好主意

根据您检查密码的方式以及瓶颈所在的位置,您可以缓存密码哈希,然后只需对此进行检查

例如,如果您在数据库中存储了密码哈希,而检索是瓶颈:

def authenticate(username, password):
    hash = get_password_hash()
    return check_password(password, hash)

@cache.memoize
def get_password_hash(username):
    return retrieve_hash_from_database()