Skip to content
  • About
    • What is Symfony?
    • Community
    • News
    • Contributing
    • Support
  • Documentation
    • Symfony Docs
    • Symfony Book
    • Screencasts
    • Symfony Bundles
    • Symfony Cloud
    • Training
  • Services
    • Platform.sh for Symfony Best platform to deploy Symfony apps
    • SymfonyInsight Automatic quality checks for your apps
    • Symfony Certification Prove your knowledge and boost your career
    • SensioLabs Professional services to help you with Symfony
    • Blackfire Profile and monitor performance of your apps
  • Other
  • Blog
  • Download
sponsored by
  1. Home
  2. Documentation
  3. Bundles
  4. SchebTwoFactorBundle

SchebTwoFactorBundle

Edit this page

This bundle provides two-factor authentication (2FA) for Symfony applications.

SchebTwoFactorBundle Logo

Documentation Index

  • Installation
  • Configuration Reference
  • Trusted Devices
  • Backup Codes
  • Brute Force Protection
  • CSRF Protection
  • Events
  • Troubleshooting (common issues)

How-to's

  • How to create a custom two-factor provider
  • How to handle multiple activated authentication methods
  • How to customize conditions when to require two-factor authentication
  • How to configure two-factor authentication for an API
  • How to create a custom persister
  • How to use a different template per firewall

Screencast

Do you prefer video tutorials? Check out the Two-Factor Authentication screencasts from SymfonyCasts.

Two-Factor Authentication Methods

The bundle supports the following authentication methods out of the box:

  • Google Authenticator
  • TOTP Authenticator
  • Code-via-Email authentication

3rd-party packages:

Note

There are 3rd-party packages for adding different two-factor authentication methods. Check out the related packages on Packagist.org.

  • Webauthn via jbtronics/2fa-webauthn
  • Text (SMS) messages via erkens/2fa-text
  • More sophisticated code-via-email via danielburger1337/scheb-2fa-email

The Authentication Process with Two-Factor Authentication

What changes when you add two-factor authentication to your application?

The bundle hooks into the security layer and listens for authentication events. When a user login appears and the user has two-factor authentication enabled, access and privileges are temporarily withheld, putting the authentication status into an intermediate state. The user is challenged to enter a valid two-factor authentication code. Only when that code is entered correctly, the associated roles are granted.

Authentication process

To represent the state between login and a valid two-factor code being entered, the bundle introduces the role-like attribute IS_AUTHENTICATED_2FA_IN_PROGRESS, which can be used in is_granted() calls. IS_AUTHENTICATED_FULLY is – just like roles – withheld until the two-factor authentication step has been completed successfully.

Contributing

Want to contribute to this project? See CONTRIBUTING.md in the repository.

Security

For information about the security policy and know security issues, see SECURITY.md in the repository.

License

SchebTwoFactorBundle is available under the MIT license.

This work, including the code samples, is licensed under a Creative Commons BY-SA 3.0 license.
TOC
    Version
    Symfony Code Performance Profiling

    Symfony Code Performance Profiling

    Show your Symfony expertise

    Show your Symfony expertise

    Version:

    Table of Contents

    • Documentation Index
      • How-to's
      • Two-Factor Authentication Methods
    • The Authentication Process with Two-Factor Authentication
    • Contributing
    • Security
    • License

    Symfony footer

    Avatar of fruty, a Symfony contributor

    Thanks fruty for being a Symfony contributor

    1 commit • 37 lines changed

    View all contributors that help us make Symfony

    Become a Symfony contributor

    Be an active part of the community and contribute ideas, code and bug fixes. Both experts and newcomers are welcome.

    Learn how to contribute

    Symfony™ is a trademark of Symfony SAS. All rights reserved.

    • What is Symfony?

      • What is Symfony?
      • Symfony at a Glance
      • Symfony Components
      • Symfony Releases
      • Security Policy
      • Logo & Screenshots
      • Trademark & Licenses
      • symfony1 Legacy
    • Learn Symfony

      • Symfony Docs
      • Symfony Book
      • Reference
      • Bundles
      • Best Practices
      • Training
      • eLearning Platform
      • Certification
    • Screencasts

      • Learn Symfony
      • Learn PHP
      • Learn JavaScript
      • Learn Drupal
      • Learn RESTful APIs
    • Community

      • Symfony Community
      • SymfonyConnect
      • Events & Meetups
      • Projects using Symfony
      • Contributors
      • Symfony Jobs
      • Backers
      • Code of Conduct
      • Downloads Stats
      • Support
    • Blog

      • All Blog Posts
      • A Week of Symfony
      • Case Studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Living on the edge
      • Releases
      • Security Advisories
      • Symfony Insight
      • Twig
      • SensioLabs Blog
    • Services

      • SensioLabs services
      • Train developers
      • Manage your project quality
      • Improve your project performance
      • Host Symfony projects

      Powered by

    Follow Symfony