Django中的用户认证

    The Django authentication system handles both authentication and authorization.Briefly, authentication verifies a user is who they claim to be, andauthorization determines what an authenticated user is allowed to do. Here theterm authentication is used to refer to both tasks.

    认证系统由以下部分组成:

    • Users
    • Permissions: Binary (yes/no) flags designating whether a user may performa certain task.
    • Groups: A generic way of applying labels and permissions to more than oneuser.
    • Forms and view tools for logging in users, or restricting content
    • 密码强度检查

    • 限制登录尝试
    • 针对第三方的身份验证(例如OAuth)
    • Object-level permissions

    Authentication support is bundled as a Django contrib module in. By default, the required configuration is alreadyincluded in the settings.py generated by django-admin
    startproject
    , these consist of two items listed in your setting:

    • SessionMiddleware manages across requests.

    • AuthenticationMiddleware associatesusers with requests using sessions.
      有了这些设置,运行命令 为auth相关模型创建必要的数据表,并为已安装应用中定义的任何模型创建许可。