首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >用Cherrypy认证

用Cherrypy认证
EN

Stack Overflow用户
提问于 2017-04-17 03:53:40
回答 1查看 946关注 0票数 1

此页的CherryPy文档包含以下片段:

代码语言:javascript
复制
from cherrypy.lib import auth_digest

USERS = {'jon': 'secret'}

conf = {
   '/protected/area': {
        'tools.auth_digest.on': True,
        'tools.auth_digest.realm': 'localhost',
        'tools.auth_digest.get_ha1': auth_digest.get_ha1_dict_plain(USERS),
        'tools.auth_digest.key': 'a565c27146791cfb'
   }
}

cherrypy.quickstart(myapp, '/', conf)

tools.auth_digest开头的4项是什么意思?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-04-17 08:11:11

摘要是一种比基本身份验证稍微安全的身份验证机制,请参见此处的定义什么是摘要认证?

我查看了CherryPy源代码,看看是否有任何关于参数含义的文档,从这个文件中可以看到这些参数是:

代码语言:javascript
复制
realm
    A string containing the authentication realm.

get_ha1
    A callable which looks up a username in a credentials store
    and returns the HA1 string, which is defined in the RFC to be
    MD5(username : realm : password).  The function's signature is:
    ``get_ha1(realm, username)``
    where username is obtained from the request's 'authorization' header.
    If username is not found in the credentials store, get_ha1() returns
    None.

key
    A secret string known only to the server, used in the synthesis of nonces.

on标志(希望很明显)只是启用摘要身份验证,并强制它搜索摘要参数,而不是基本的auth参数。

请注意,get_ha1参数是可调用的,从搜索文件中有3个版本:

代码语言:javascript
复制
get_ha1_dict_plain
get_ha1_dict
get_ha1_file_htdigest

如果您想确切地了解这些函数是如何工作的,那么这些函数上有适当的docstring。

希望这能帮上忙!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/43444892

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档