umanit/2fa-sms

Extends scheb/2fa-bundle with two-factor authentication via SMS

Installs: 20

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0.0 2025-03-24 15:45 UTC

This package is auto-updated.

Last update: 2025-03-24 15:46:36 UTC


README

Build Status Latest Stable Version License

This package extends scheb/2fa-bundle with two-factor authentication using SMS.

Installation

composer require umanit/2fa-sms
// config/bundles.php
return [
    Symfony\Bundle\FrameworkBundle\FrameworkBundle::class => ['all' => true],
    Scheb\TwoFactorBundle\SchebTwoFactorBundle::class => ['all' => true],
    Umanit\TwoFactorSms\UmanitTwoFactorSmsBundle::class => ['all' => true],
];

Configuration

In order to work, the bundle uses Symfony's Notifier component and the SMS channel managed by the texter service. You'll need to configure your application with an SMS channel before you can use this bundle.

These are the default configuration values.

# Default configuration for extension with alias: "umanit_two_factor_sms"
umanit_two_factor_sms:
    enabled:              true

    # A custom form renderer service that must implement "Scheb\TwoFactorBundle\Security\TwoFactor\Provider\TwoFactorFormRendererInterface".
    form_renderer:        null

    # Twig template to pass to "Scheb\TwoFactorBundle\Security\TwoFactor\Provider\DefaultTwoFactorFormRenderer".
    template:             '@SchebTwoFactor/Authentication/form.html.twig'

    # Custom auth code generator service that must implement "Umanit\TwoFactorSms\Security\AuthCode\AuthCodeGeneratorInterface".
    code_generator:       null

    # The number of digits the generated auth code will have.
    digits:               6

    # Custom auth code sender service that must implement "Umanit\TwoFactorSms\Security\AuthCode\AuthCodeSenderInterface".
    code_sender:          null

    # A valid \DateInterval used to expire the auth code.
    expires_after:        PT15M

    # Custom auth code texter service that must implement "Umanit\TwoFactorSms\Texter\AuthCodeTexterInterface".
    code_texter:          null

    # Custom texter message generator service that must implement "Umanit\TwoFactorSms\Texter\SmsMessageGeneratorInterface".
    message_generator:    null

    # Message send by the texter. The template string [[auth_code]] will be replaced with the actual auth code.
    message:              '[[auth_code]]'

License

This software is available under the MIT license.