browserid协议的python库

PyBrowserID的Python项目详细描述


这是一个用于browserid协议的python客户机库,它是 Mozilla角色:

https://login.persona.org/

对于大多数部署,您只需要调用模块- 级别“verify”函数来验证给定的断言:

>>> data = browserid.verify(BROWSERIDASSERTION, "http://mysite.com")
>>> print data["email"]
"test@example.com"

此功能的精确实现将根据 Browserid团队当前的建议。目前它发布了 对persona.org上的远程验证程序服务的断言。

注意,必须将站点的根url指定为第二个参数 为了那个功能。这是“预期的观众”,是关键的安全措施 棕色的特征。

如果您无法确定站点的确切主机名 正在被访问(例如由于虚拟主机),则可以指定一个或 更多通配符模式,如so:

>>> data = browserid.verify(BROWSERIDASSERTION, ["http://*.mysite.com"])
>>> print data["email"]
"test@example.com"

为了更好地控制验证过程,可以创建 一个“验证器”类,避免在 再来一遍:

>>> verifier = browserid.RemoteVerifier(["*.mysite.com"])
>>> data = verifier.verify(BROWSERIDASSERTION)
>>> print data["email"]
"test@example.com"

为了提高性能,或者如果你只想活在流血的边缘, 您可以使用localverifier显式地在本地执行验证 像这样上课:

>>> verifier = browserid.LocalVerifier(["*.mysite.com"])
>>> data = verifier.verify(BROWSERIDASSERTION)
>>> print data["email"]
"test@example.com"

注意browserid协议的细节仍在变化中,所以 由于不兼容的更改,本地验证可能会中断。作为事物 稳定这将成为默认实现。

0.14.0-2018-01-12

  • Silence warnings about assertion format changes, since there’s now no risk of this.

0.13.0-2017年12月20日

  • Use LocalVerifier by default, now that the hosted verifier has shut down.

0.12.0-2017年5月29日

  • Add support for extra “idpClaims” and “userClaims” when using the LocalVerifier class.

0.11.0-2016年5月11日

  • Have the local verifier validate that the email address is well-formed, to avoid passing e.g. null bytes through to code that doesn’t properly handle them.

0.10.0-2016-03-09

  • Add support for “idpClaims” and “userClaims” when generating test assertions. This helps when using this library to interact with Firefox Accounts.

0.9.2-2014年4月13日

  • Remove tuple paramter unpacking for python3.
  • Add “description” attribute to Error objects.

0.9.1-2012年11月26日

  • Fix data-decoding bug in fallback crypto routines.

0.9.0-2012年10月4日

  • Support for Python 3.

0.8.0-2012年8月1日

  • Correct the pure-python RSA implementation. Unfortunately this requires a small backwards-incompatible API change on RSKey objects (the SIZE property is now DIGESTSIZE and it gives the size of the internal hex digest string in bytes)

0.7.0-2012年7月26日

  • Added a pure-python implementation of the JWT crypto routines, for use when M2Crypto is not available.
  • Added “from_pem_data” and “to_pem_data” methods to Key objects. Currently these are only available when M2Crypto is installed.
  • Added support for delegation of authority; thanks @kylef.
  • Use https://verifier.login.persona.org/verify for remote verification

0.6.2-2012年7月17日

  • Add persona.org and related sites to the list of default trusted secondaries.

0.6.1-2012年6月7日

  • Disable certificate chaining for now. This feature is not used by any servers in the wild, and the spec for it is going to change soon.

0.6.0-2012-31-05

  • Remove ability to use a custom JWT parser class, it’s not used and adds needless complexity.
  • Add a way to skip the ssl verification when getting certificates with the CertificateManager.

0.5.0-2012年4月18日

  • add support of requests rather than custom code for ssl checking when retrieving certificates.
  • removed patch utility for secure_urlopen (we are now using requests)
  • add more verbose errors when dealing with RSA/DSA Keys.

0.4.0-2012年3月13日

  • Renamed from PyVEP to PyBrowserID, in keeping with Mozilla branding.
  • Audience checking now accepts glob-style patterns as well as fixed audience strings.
  • Verifier objects now accept a list of audience patterns as their first argument. This is designed to encourage doing the right thing rather than, say, passing in the hostname from the request.
  • Allowed LocalVerifier to use of a custom JWT parser.
  • Removed browserid.verify_[remote|local|dummy] since they just cause confusion. You should either accept the defaults provided by the browserid.verify function, or use a full-blown Verifier object.
  • Split certificate loading and caching into a separate class, in browserid.certificates:CertificatesManager.
  • Removed the DummyVerifier class in favour of supporting functions in browserid.tests.support.

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

推荐PyPI第三方库


热门话题
java如何按专辑中曲目的数量过滤这些歌曲   JavaSWT:如何从动作创建普通按钮   java如何使用具有此特定公式的未排序数组实现二叉搜索树?   java PDFBox 2.0.4:提取图像时内存使用率高   java无法实例化类型集   JavaSpring服务周期性任务   java如何在用户打开活动时发出网络请求,但前提是自上次请求已过24小时?   c#如何从Hibernate/NHibernate中的值对象引用实体?   在命令行上运行java时,显示sql server错误消息“java.lang.ClassNotFoundException:com.microsoft.sqlserver.jdbc.SQLServerDriver”   java数据提供者和断言   java模运算符未给出正确的结果   如何将Eclipse java项目部署到jar文件中   java动态规划问题“以输入价格购买玩家后,总评分必须最高”   java我必须为数组的每个元素制作getter setter吗?   未调用java JUnit RunListener   java如何计算加入多播socket的客户端?