熊猫瓶授权!
Flask-Authorization-Panda的Python项目详细描述
**flask authorization panda是一个flask扩展,它为restful web服务的各种身份验证方法提供decorators
。目前,只支持http基本身份验证。**
usage
----
>;>;from flask.ext.flask_authorization_panda import basic_auth
在应用程序初始化期间,将所需的用户名/密码存储在
配置属性:
app=flask(u name_u)
app.config['basic_u auth_credentials']=dict(用户名='admin',
password='secret')
最后,简单地将@basic_auth decorator应用于需要http basic auth的方法:
>;@app.route('/')
>;@basic_auth
>;>def hello嫒world():
>;@return jsonify({“statuscode”:200,“message”:“ok”})
这将导致对修饰方法的所有调用,以(1)检查请求授权对象上的凭据是否
,以及(2)验证
是否与app.config['basic_auth_credentials]的内容匹配
。目前,只支持http基本身份验证。**
usage
----
>;>;from flask.ext.flask_authorization_panda import basic_auth
在应用程序初始化期间,将所需的用户名/密码存储在
配置属性:
app=flask(u name_u)
app.config['basic_u auth_credentials']=dict(用户名='admin',
password='secret')
最后,简单地将@basic_auth decorator应用于需要http basic auth的方法:
>;@app.route('/')
>;@basic_auth
>;>def hello嫒world():
>;@return jsonify({“statuscode”:200,“message”:“ok”})
这将导致对修饰方法的所有调用,以(1)检查请求授权对象上的凭据是否
,以及(2)验证
是否与app.config['basic_auth_credentials]的内容匹配