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 SensioLabs
  1. Home
  2. Documentation
  3. Bundles
  4. SchebTwoFactorBundle
  • Documentation
  • Book
  • Reference
  • Bundles
  • Cloud

Table of Contents

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

SchebTwoFactorBundle

Edit this page

SchebTwoFactorBundle

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

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
    We stand with Ukraine.
    Version:
    Online exam, become Sylius certified today

    Online exam, become Sylius certified today

    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Peruse our complete Symfony & PHP solutions catalog for your web development needs.

    Symfony footer

    ↓ Our footer now uses the colors of the Ukrainian flag because Symfony stands with the people of Ukraine.

    Avatar of geoffrey, a Symfony contributor

    Thanks geoffrey for being a Symfony contributor

    3 commits • 1.20K 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?

      • Symfony at a Glance
      • Symfony Components
      • Case Studies
      • 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

      • SymfonyConnect
      • Support
      • How to be Involved
      • Code of Conduct
      • Events & Meetups
      • Projects using Symfony
      • Downloads Stats
      • Contributors
      • Backers
    • Blog

      • Events & Meetups
      • A week of symfony
      • Case studies
      • Cloud
      • Community
      • Conferences
      • Diversity
      • Documentation
      • Living on the edge
      • Releases
      • Security Advisories
      • SymfonyInsight
      • Twig
      • SensioLabs
    • Services

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

      Deployed on

    Follow Symfony

    Search by Meilisearch