我正在使用flask-peewee构建一个新项目。另外,我使用的是flask peewee中包含的REST接口。我遵循了这里的示例http://flask-peewee.readthedocs.org/en/latest/getting-started.html#exposing-content-using-a-rest-api和http://flask-peewee.readthedocs.org/en/latest/rest-api.html#rest-api,所以我能够启动并运行Rest api,包括向rest添加Auth。
然而,我的问题是我不能保证GET请求的安全。到目前为止,我已经浏览了rest.py https://github.com/coleifer/flask-peewee/blob/master/flask_peewee/rest.py的源代码,但无法找到这是从哪里来的,尽管我确实找到了许多好东西,可以在以后使用。
默认情况下,REST API似乎只保护POST/PUT/DELETE,而不是GET。
我不想让使用flask url变得安全,我希望flask peewee有一些内置的方法。或者,如果这是一个已知的限制,那么处理这个问题的好方法是什么?
有什么想法吗?
发布于 2012-06-05 21:13:44
很抱歉,您在查找此信息时遇到问题。您可以指定在实例化auth类时需要进行身份验证的HTTP谓词列表:
# when instantiating your authentication
api_auth = UserAuth(auth, protected_methods=['GET', 'POST', 'PUT', 'DELETE'])
read_only_auth = UserAuth(auth) # default protected methods are POST/PUT/DELETE以下是这些文档的链接:
http://flask-peewee.readthedocs.org/en/latest/api.html#authenticating-requests-to-the-api
https://stackoverflow.com/questions/10874973
复制相似问题