Skip to content

Latest commit

 

History

History
90 lines (49 loc) · 5 KB

File metadata and controls

90 lines (49 loc) · 5 KB
graph LR
    UserSocialAuth["UserSocialAuth"]
    Association["Association"]
    Nonce["Nonce"]
    DjangoStorage["DjangoStorage"]
    user_model["user_model"]
    username_field["username_field"]
    username_max_length["username_max_length"]
    DjangoStorage -- "manages the lifecycle of" --> UserSocialAuth
    DjangoStorage -- "manages the lifecycle of" --> Association
    DjangoStorage -- "manages the lifecycle of" --> Nonce
    DjangoStorage -- "relies on" --> username_field
    DjangoStorage -- "relies on" --> username_max_length
    username_max_length -- "calls" --> user_model
    username_max_length -- "calls" --> username_field
Loading

CodeBoardingDemoContact

Details

This subsystem provides the core logic and data models for integrating social authentication with Django's user system. It is responsible for managing the creation and existence checks of Django users, linking social accounts, and persisting social authentication-related data such as tokens, associations, and nonces. It extends Django's built-in authentication capabilities to support external identity providers.

UserSocialAuth

A Django Model that defines the database schema for linking a social account (e.g., Facebook, Google) to a specific Django user. It stores provider-specific user IDs, access tokens, and other relevant social authentication details, acting as the crucial link between an external identity and the internal Django User model.

Related Classes/Methods:

Association

A Django Model representing a database model for storing OpenID associations. These are vital for establishing trust between an OpenID provider and the application, helping to prevent replay attacks and verify identity during the authentication process.

Related Classes/Methods:

Nonce

A Django Model defining a database model for storing nonces (numbers used once). This is a security measure used in authentication protocols like OpenID Connect to prevent replay attacks by ensuring that a request cannot be used more than once.

Related Classes/Methods:

DjangoStorage

Serves as the primary interface and adapter for persisting and retrieving all social authentication-related data. It encapsulates the core logic for interacting with Django's user system, including creating new Django users, checking for existing users, and managing the lifecycle of UserSocialAuth, Association, and Nonce objects. It abstracts the underlying database operations, adhering to Django's ORM patterns.

Related Classes/Methods:

user_model

A utility function that dynamically retrieves the currently active Django User model, respecting the AUTH_USER_MODEL setting in Django's configuration. This ensures flexibility and compatibility with custom user models.

Related Classes/Methods:

username_field

A utility function that determines which field of the Django User model should be used as the username. This allows the system to adapt to different Django User model configurations.

Related Classes/Methods:

username_max_length

A utility function that determines the maximum length allowed for the username field of the Django User model, ensuring data integrity and adherence to model constraints.

Related Classes/Methods: