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

配置

JSONAuthenticatorPlugin

这个插件使用一个JSON对象作为数据库,对象中的每个键都是 userid和值是另一个对象,具有关于用户的特定详细信息,其中 然后可以与JSONPropertiesPlugin一起使用来检索有关 用户

用户的每条记录至少必须包含一个password条目,以便 用户可以进行身份验证,例如:

data={
  "someuser": {"password": "abc123"},
  "otheruser": {"password": "xyz789"}
}
SettingDefaultDescription
^{tt8}$Required A JSON object contaiing records for each test userid.

jsonpropertieslugin

此插件使用验证器数据中的特定密钥来查找 有关用户的特定详细信息。

SettingDefaultDescription
^{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)

  • 最初的释放

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
当注释bean用作另一个bean中的集合时,java自定义约束验证器不工作   毕加索中的java错误get()无法应用于(安卓.content.Context)   java RSA Encryption生成带有“\n”字符的字符串,我无法解密   java使用无线路由器访问Wamp   java EhCache磁盘持久性可以持久化任意对象   将文件复制到数组(Java)   Java JScience:如何打印整个实数?   用户界面在JAVA中鼠标点击“设置”按钮时如何获取文本字段内容   JAVA中ArrayList<ArrayList>的深度副本   eclipse的java代码感知样式自动完成   netbeans 7无法从另一个平台运行java项目   hbm中的java异常。xml   java在电子邮件正文中发送HTML   按名称列出的tomcat Java jconsole应用程序   在活动之间传递ArrayList的java机制   Java中long的模运算符是什么?