Django User authentication

Source: Internet
Author: User

Django User authentication system

Django comes with a user authentication system. This system primarily acts on user accounts, groups, permissions, and cookie-based user sessions. This blog post will focus on how this default self-contained user authentication system works, and how to extend and customize the default self-contained user authentication system in your own project.

Overview:

The Django authentication system handles both authentication and authorization tasks. In short, authentication is the verification of who a user is, and authorization is the decision of what an authenticated user can write. The certification referred to here is to include both tasks.

The composition of the authentication system:

    • User
    • Permissions: Binary flag bits indicates that a user has permission to do a task
    • Group: Common methods for applying the same tags and permissions to multiple users
    • A configurable hash cipher system
    • User-logged-in forms and view tools, limiting content
    • Pluggable back-up system

Django's authentication system is very versatile and does not provide some of the features that are common in Web authentication systems. But these are common problems that are provided by a third-party solution:

    • Password strength Check
    • Limitations of Login Intent
    • Authentication of third-party permissions (e.g. OAuth)
Installation

The authentication module is bundled in Django as a module in the Django.contrib.auth. Run the Django-admin startproject command to create project, by default, the configuration required by the authentication module is already included in the settings.py, and two components are listed in the Installed_apps in the settings.py file:

    1. ' Django.contrib.auth ' contains the core of the certification framework and the default model of its book
    2. ' Django.contrib.contenttypes ' is a Django content-type system that allows you to create models and permissions together

There are also the following options within the Middleware_class configuration:

    1. Sessionmiddleware managing sessions in requests
    2. Authenticationmiddleware the user and the request to use the session together
    3. Sessionauthenticationmiddleware Records after the user password is modified, the user exits the other session.

All of the above are automatically configured to run the Django-admin startproject command, and then the manage.py Migrate command will create database tables and permissions for models in the apps you created installed.

Usage:

Using Django's default support

    • Working with User objects
    • Permissions and authorizations
    • Web request authentication
    • Manage users in admin background

Default supported API reference manuals

Customizing Users and Certifications

Password management in Django

Django User authentication

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.