Skip to main content

Django Authentication backend that can use any field in the user table for identification.

Project description

Use any field in the user table for identification (as principal), such as ‘first name’, ‘id’ or ‘email’. It can be used in parallel or completely replace the standard django authentication backend (django.contrib.auth.backends.ModelBackend)

This version is supported on Python 3.6+; and Django 2.2+.

Installation

Install the package with pip:

$ pip install django-anyfield-auth-backend

To use the auth backend in a Django project, add 'django-anyfield-auth-backend' to AUTHENTICATION_BACKENDS. Do not add anything to INSTALLED_APPS.

AUTHENTICATION_BACKENDS += [
    'django-anyfield-auth-backend',
]

Configuration

Just configure the fields to be searched in the settings:

AUTH_ANYFIELDS (default [‘id’,’email’])
All fields that will be used to look for the user.
AUTH_ANYFIELDS_ONLY_UNIQUE_USERS (Default = True)
Allow only uniquely identified users.

Warning: false means that “all matched users” will be used to attempt authentication. This option is NOT recommended because of security and performance gaps.

Tests

To run the tests

python load_tests.py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django-anyfield-auth-backend-1.0.1.tar.gz (4.2 kB view hashes)

Uploaded Source

Built Distribution

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page