elliot-sawyer/totp-authenticator

启用基于TOTP的2FA认证

安装次数: 11,848

依赖项: 0

建议者: 0

安全: 0

星标: 5

关注者: 3

分支: 1

公开问题: 13

类型:silverstripe-vendormodule

0.0.2 2018-02-16 02:47 UTC

This package is auto-updated.

Last update: 2024-08-27 16:22:22 UTC


README

Code Coverage Scrutinizer Code Quality

SilverStripe TOTP (基于时间的单次密码) 认证器

这是一个为SilverStripe设计的基于时间的令牌认证器。它允许使用Google Authenticator或Authy等应用程序的用户生成用于登录SilverStripe安装的代码。如果用户的第二因素丢失、被盗或不可用,用户也可以获得备份代码。

它扩展并基于Firesphere的MFABootstrap模块,并在CWP 2.0和SilverStripe 4.1.1的纯安装上进行了测试。

支持的认证器

支持所有认证器应用程序的列表很困难,但在首次发布时,以下认证器被支持。

  • Google Authenticator
  • Authy

如果您知道其他可以添加到这个列表的认证器,请提交一个拉取请求,并附带您添加的任何代码和单元测试,以确保支持。

安装

composer require elliot-sawyer/totp-authenticator

配置

将以下内容添加到config.yml

SilverStripe\Security\Member:
  extensions:
    - ElliotSawyer\TOTPAuthenticator\MemberExtension

SilverStripe\Core\Injector\Injector:
  SilverStripe\Security\Security:
    properties:
      Authenticators:
        totpauthenticator: %$ElliotSawyer\TOTPAuthenticator\TOTPAuthenticator

算法

Google Authenticator和Authy仅支持使用SHA-1生成的令牌。其他认证器可能会实现SHA-256或SHA-512,如RFC6238中概述。如果您需要支持特定的TOTP认证器,您可以使用Config API调整此算法。

ElliotSawyer\TOTPAuthenticator\TOTPAuthenticator:
  algorithm: 'sha512'

使用

  1. 如常登录CMS,注意使用“默认”认证器。访问安全管理界面并选择您的用户。暂时忽略TOTPSecret字段。勾选“MFA启用”和“重置MFA代码”,然后保存成员。
  2. 请注意您的备份令牌,因为如果认证器丢失、被盗或不可用,可以使用它们登录您的账户。这些令牌以加密方式存储在数据库中,无法恢复。如果丢失,必须重置。
  3. 返回主标签并显示“第二个因素令牌密钥”。使用Google Authenticator或Authy扫描QR码。您的网站名称(由站点标题定义)和您的用户名在Google Authenticator的末尾可见。
  4. 访问https://yoursite.local/Security/login/totpauthenticator登录。您将需要输入第二个因素访问代码。

待办事项

请在https://github.com/elliot-sawyer/totp-authenticator/issues提出问题和功能请求。