erkens / 2fa-text
通过简单的短信实现扩展 scheb/2fa-bundle 的双因素认证
v3.0.0
2024-06-17 20:06 UTC
Requires
- php: ^8.0
- scheb/2fa-bundle: ^7.3
Requires (Dev)
- symfony/http-client: ^7.0
README
此软件包通过短信扩展了 scheb/2fa-bundle 的双因素认证功能。
它基于官方的 scheb/2fa-email 软件包。
使用方法
在安装并配置了 scheb/2fa-bundle 之后,您可以安装此软件包
composer require erkens/2fa-text
首先需要创建一个新的服务,该服务实现 Erkens\Security\TwoFactorTextBundle\TextSender\AuthCodeTextInterface
,这样我们就可以发送短信或文本消息。然后,您可以将该服务用作配置中的 "auth_code_sender"
two_factor_text:
enabled: true
auth_code_sender: Erkens\Security\TwoFactorTextBundle\TextSender\ExampleTextSender
digits: 6
text: 'To login, use this code: %s'
template: '@SchebTwoFactor/Authentication/form.html.twig'
您可以将此服务添加到 config/packages
内的独立 yaml 文件中,或者将其放置在现有的 scheb_2fa.yaml
文件内。但请确保您在 yaml 树的根目录下有 two_factor_text
(不在 scheb_two_factor
之下)。
接下来
您的 User
实体必须实现 Erkens\Security\TwoFactorTextBundle\Model\TwoFactorTextInterface
并实现所需的方法。
许可证
本软件可在 MIT 许可证 下使用。