scheb / 2fa

Two-factor authentication for Symfony applications 🔐
MIT License
505 stars 75 forks source link

How to use / configure a custom 2fa provider ? #164

Closed PauchardThomas closed 2 years ago

PauchardThomas commented 2 years ago

Bundle version: 6.3.0 Symfony version: 6.0.11 PHP version: 8.1.10 Using authenticators (enable_authenticator_manager: true): YES / NO

Description

Hello, i'm trying to implement a custom two-factor provider. Following the doc, i registered my service as described :

    app.twilio_two_factor_provider:
        class: App\Infrastructure\TwoFa\TwilioTextSenderProvider
        public: true
        tags:
            - { name: scheb_two_factor.provider, alias: twilio_two_factor_provider }

Then add it to the scheb_two_factor.yaml file :

scheb_two_factor:
    security_tokens:
        - Symfony\Component\Security\Core\Authentication\Token\UsernamePasswordToken
        - Symfony\Component\Security\Http\Authenticator\Token\PostAuthenticationToken
    twilio_two_factor_provider:
        enabled: true

But got an Exception :

_Unrecognized option "twilio_two_factor_provider" under "scheb_two_factor". Available options are "email", "google", "ip_whitelist", "ip_whitelist_provider", "model_manager_name", "persister", "security_tokens", "trusted_device", "two_factor_condition", "two_factor_tokenfactory".

What am I doing wrong ?

Thanks

Ps : Got the same problem when trying to use https://github.com/Erkens/2fa-text

scheb commented 2 years ago

You don't need this part:

    twilio_two_factor_provider:
        enabled: true

A custom 2fa-provider is automatically enabled.

stale[bot] commented 2 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.