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 details)

Uploaded Source

Built Distribution

File details

Details for the file django-anyfield-auth-backend-1.0.1.tar.gz.

File metadata

  • Download URL: django-anyfield-auth-backend-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for django-anyfield-auth-backend-1.0.1.tar.gz
Algorithm Hash digest
SHA256 ad5b62e25d464eddc0fe6135dfe341aad583f212ee34bca48e26340091ff1eeb
MD5 3efbe47b94ff4e1d3acc7ca40148618c
BLAKE2b-256 ec0ecef905ba1aea2d78354481cff52b17a00a472a4bf09ba361ed6250de4434

See more details on using hashes here.

File details

Details for the file django_anyfield_auth_backend-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: django_anyfield_auth_backend-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for django_anyfield_auth_backend-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6aab743ac554047538a2563100ee411622a9ea09475925c7865e6be63b3844eb
MD5 425b4a1a8051d34908f2853d53c75c8b
BLAKE2b-256 bf9fb2b497c5741acd5611325e40ef19852b8e1c049af57fca9f101e797be0b3

See more details on using hashes here.

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