Skip to content

Latest commit

 

History

History
82 lines (48 loc) · 5.89 KB

File metadata and controls

82 lines (48 loc) · 5.89 KB
graph LR
    django_contrib_auth_models_User["django.contrib.auth.models.User"]
    Django_Session_Management["Django Session Management"]
    two_factor_views_core_get_user["two_factor.views.core.get_user"]
    two_factor_views_core_get_device["two_factor.views.core.get_device"]
    two_factor_views_core_get_devices["two_factor.views.core.get_devices"]
    two_factor_views_core_remember_agent["two_factor.views.core.remember_agent"]
    django_contrib_auth_models_User -- "Provides the user object" --> two_factor_views_core_get_user
    django_contrib_auth_models_User -- "Provides user context for device lookup" --> two_factor_views_core_get_device
    Django_Session_Management -- "Provides session data for user context" --> two_factor_views_core_get_user
    Django_Session_Management -- "Stores and retrieves "remember me" state" --> two_factor_views_core_remember_agent
    two_factor_views_core_get_user -- "Retrieves the user instance" --> django_contrib_auth_models_User
    two_factor_views_core_get_user -- "Accesses session to determine authenticated user" --> Django_Session_Management
    two_factor_views_core_get_device -- "Depends on `get_user` to identify the current user" --> two_factor_views_core_get_user
    two_factor_views_core_get_device -- "Queries devices associated with the user" --> django_contrib_auth_models_User
    two_factor_views_core_get_devices -- "Depends on `get_user` to identify the current user" --> two_factor_views_core_get_user
    two_factor_views_core_get_devices -- "Queries all devices associated with the user" --> django_contrib_auth_models_User
    two_factor_views_core_remember_agent -- "Depends on `get_user` for user context" --> two_factor_views_core_get_user
    two_factor_views_core_remember_agent -- "Stores the "remember me" token/state" --> Django_Session_Management
Loading

CodeBoardingDemoContact

Details

The django-two-factor-auth subsystem primarily extends Django's core authentication by integrating two-factor authentication (2FA) capabilities. At its heart, it leverages Django's built-in User model for identity management and Session Management for maintaining user state and "remember me" functionality. The subsystem's core logic revolves around functions like get_user for retrieving the authenticated user, get_device and get_devices for managing 2FA devices, and remember_agent for handling persistent authentication. These components interact to provide a seamless and secure 2FA experience, ensuring that user authentication, device management, and session persistence are robustly handled within the Django framework.

django.contrib.auth.models.User

The fundamental Django User model, representing the authenticated user. All authentication and 2FA operations revolve around this entity, providing the core user data structure and authentication capabilities. It is the central identity for all operations.

Related Classes/Methods:

Django Session Management

Django's built-in mechanism for managing user sessions, including authentication status and session data. django-two-factor-auth implicitly interacts with this for maintaining user context and "remember me" functionality, managing the user's authenticated state across requests.

Related Classes/Methods: None

two_factor.views.core.get_user

A utility function within django-two-factor-auth responsible for safely retrieving the currently authenticated User object from the Django request. It acts as an interface to the core Django user context, abstracting and providing access to the authenticated User object.

Related Classes/Methods:

two_factor.views.core.get_device

Retrieves a specific two-factor authentication device associated with the current user, often based on the current authentication step or method. Responsible for querying and retrieving individual 2FA devices linked to the authenticated user.

Related Classes/Methods:

two_factor.views.core.get_devices

Fetches all registered two-factor authentication devices for the current user, providing a comprehensive list of available 2FA methods. Responsible for querying and retrieving all 2FA devices linked to the authenticated user.

Related Classes/Methods:

two_factor.views.core.remember_agent

Manages the "remember me" functionality, allowing users to bypass 2FA on subsequent logins from a trusted device for a set period. This involves interacting with Django's session or cookie mechanisms, managing the "remembered" state of a device.

Related Classes/Methods: