graph LR
Two_Factor_Authentication_Core["Two-Factor Authentication Core"]
2FA_Method_Registry["2FA Method Registry"]
Pluggable_2FA_Methods["Pluggable 2FA Methods"]
External_Communication_Gateway["External Communication Gateway"]
Django_OTP_Data_Layer["Django OTP & Data Layer"]
Django_Authentication_System["Django Authentication System"]
Django_Authentication_System -- "delegates authentication requests to" --> Two_Factor_Authentication_Core
Two_Factor_Authentication_Core -- "queries" --> 2FA_Method_Registry
2FA_Method_Registry -- "dispatches control to" --> Pluggable_2FA_Methods
Pluggable_2FA_Methods -- "requests challenge delivery through" --> External_Communication_Gateway
Pluggable_2FA_Methods -- "interacts with" --> Django_OTP_Data_Layer
Two_Factor_Authentication_Core -- "retrieves and updates 2FA device information and state via" --> Django_OTP_Data_Layer
Two_Factor_Authentication_Core -- "signals" --> Django_Authentication_System
click Two_Factor_Authentication_Core href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/Two_Factor_Authentication_Core.md" "Details"
click 2FA_Method_Registry href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/2FA_Method_Registry.md" "Details"
click Pluggable_2FA_Methods href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/Pluggable_2FA_Methods.md" "Details"
click External_Communication_Gateway href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/External_Communication_Gateway.md" "Details"
click Django_OTP_Data_Layer href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/Django_OTP_Data_Layer.md" "Details"
click Django_Authentication_System href "https://github.com/CodeBoarding/GeneratedOnBoardings/blob/main/django-two-factor-auth/Django_Authentication_System.md" "Details"
The django-two-factor-auth project provides a robust, pluggable two-factor authentication system for Django applications. At its core, the Two-Factor Authentication Core orchestrates the entire 2FA flow, managing user interactions and session state. It dynamically interacts with the 2FA Method Registry, which acts as an extensible lookup service for various Pluggable 2FA Methods (e.g., Phone, WebAuthn). These methods encapsulate the specific logic for generating and verifying authentication challenges. For external communication, such as sending SMS or making calls, the system utilizes the External Communication Gateway, which provides an abstract interface for different concrete implementations. All 2FA device management and data persistence are handled by the Django OTP & Data Layer, which integrates with the django-otp library and manages related data models. Finally, the entire system seamlessly integrates with the Django Authentication System, extending its core functionalities for user authentication and session management.
Two-Factor Authentication Core [Expand]
The central orchestrator of the multi-step 2FA authentication flow. It manages user sessions, input, redirects, and coordinates with various 2FA methods, integrating directly with Django's core authentication.
Related Classes/Methods:
2FA Method Registry [Expand]
Implements a plugin-like system for registering and providing access to different 2FA methods. It acts as a central lookup service, enabling extensibility for new authentication methods.
Related Classes/Methods:
Pluggable 2FA Methods [Expand]
Represents the various concrete 2FA implementations (e.g., Phone, WebAuthn). Each method encapsulates the specific logic for generating, sending, and verifying its respective authentication challenge.
Related Classes/Methods:
two_factor/plugins/phonenumber/method.pytwo_factor/plugins/phonenumber/views.pytwo_factor/plugins/webauthn/method.pytwo_factor/plugins/webauthn/views.py
External Communication Gateway [Expand]
Defines the abstract interface for external communication, primarily for sending SMS messages or making voice calls for 2FA challenges. It allows for different concrete gateway implementations.
Related Classes/Methods:
Django OTP & Data Layer [Expand]
Manages OTP devices and integrates with the django-otp library, which provides the core framework for OTP device management and verification. This component also handles the persistence of 2FA-related data models.
Related Classes/Methods:
Django Authentication System [Expand]
Represents the interaction with Django's built-in authentication system, including user context, session management, and the user model. django-two-factor-auth extends and integrates with this core Django functionality.
Related Classes/Methods: