repoze.who的开发模式插件
who_dev的Python项目详细描述
谁开发
为repoze.who v2 wsgi应用程序测试authenticataion
此插件用于快速配置测试用户 发展目的。不建议在生产系统中使用
安装
pip install who_dev
安装主线开发分支
插件位于a git branch hosted at github.com中获取最新消息 代码,运行:
git clone git@github.com:m-martinez/who_dev.git
然后运行下面的命令:
pip install -e who_dev/
在ini文件中配置repoze.who。
您可以通过*.ini文件配置基于repoze.who的身份验证, 然后在应用程序中加载这些设置。
假设我们有一个名为who.ini的文件,其中包含以下内容:
[general] request_classifier = repoze.who.classifiers:default_request_classifier challenge_decider = repoze.who.classifiers:default_challenge_decider [identifiers] plugins = auth_tkt [authenticators] plugins = auth_tkt dev_auth [challengers] plugins = form;browser [mdproviders] plugins = dev_properties dev_groups [plugin:form] use = repoze.who.plugins.form:make_plugin rememberer_name = auth_tkt [plugin:auth_tkt] use = repoze.who.plugins.auth_tkt:make_plugin secret = s3kr1t [plugin:dev_auth] use = who_dev:JSONAuthenticatorPlugin data = { "someuser": { "password": "abc123", "properties": { "first_name": "Some", "last_name": "User", "email": "someuser@localhost" }, "groups": ["members", "editors"] } } [plugin:dev_properties] use = who_dev:JSONPropertiesPlugin source_key = properties [plugin:dev_groups] use = who_dev:JSONPropertiesPlugin source_key = groups
特定于框架的文档
您可能需要查看以下特定于框架的文档以了解提示 如何在您使用的框架中实现repoze.who
- Pyramid: pyramid_who.
- Pylons: Authentication and Authorization with repoze.who.
- TurboGears 2: Authentication and Authorization in TurboGears 2 (^{tt1}$ is the default authentication library).
配置
JSONAuthenticatorPlugin
这个插件使用一个JSON对象作为数据库,对象中的每个键都是 userid和值是另一个对象,具有关于用户的特定详细信息,其中 然后可以与JSONPropertiesPlugin一起使用来检索有关 用户
用户的每条记录至少必须包含一个password条目,以便 用户可以进行身份验证,例如:
data={ "someuser": {"password": "abc123"}, "otheruser": {"password": "xyz789"} }
Setting | Default | Description |
---|---|---|
^{tt8}$ | Required A JSON object contaiing records for each test userid. |
jsonpropertieslugin
此插件使用验证器数据中的特定密钥来查找 有关用户的特定详细信息。
Setting | Default | Description |
---|---|---|
^{tt9}$ | Required Sets the remote user data to the value located at ^{tt9}$ for the currently authenticated userid. |
变更日志
0.0.2(2016-06-22)
- 已转换为实际模块,因此setup.py包正确
0.0.1(2015-10-19)
- 最初的释放