Skip to main content

DRF Advanced Authentication

Django REST Framework provides just about everything needed to turn your Django app into a REST-based web application. One area that DRF lacks functionality is in the non-happy path scenarios related to authentication, namely password changes and password resets. This module aims to simplify setting up a full auth subsystem for your REST application.

The functions provided by this package are:

  • login: an endpoint for authenticating a user
  • logout: an endpoint for ending a user's session
  • change password: an endpoint for changing the password of a logged-in user
  • reset password: two endpoints that together can be used to reset the password of a logged-out user (lost password, etc)

Note: This package is a work in progress (that's why it's not yet at version 1.0). I am active seeking contributions to help with making it more usable, see "Contributing" below.

Installation

Install the package:

$ pip install drf-advanced-auth

Add it to INSTALLED_APPS:

INSTALLED_APPS = [
    ...
    'drf_advanced_auth',
    ...
]

Update your URLs by adding the drf_advanced_auth urls under whatever prefix you want, and another url named password_reset_confirm that you want users to be redirected to when they click the link in the password reset email:

urlpatterns = [
    url(r'^auth/', include('drf_advanced_auth.urls', namespace='authentication')),
    url(r'^password-reset/update/(?P<uidb64>.*)/(?P<token>.*)', FakeView.as_view(), name='password_reset_confirm'),
]

Usage

(IN PROGRESS)

Sample App

You can see a sample app using these fields buy running the following:

$ python manage.py migrate
$ python manage.py loaddata fixtures/base.json
$ python manage.py runserver

This app has the following endpoints (assuming they are under the auth prefix as shown above):

  • /auth/login/
  • /auth/logout/
  • /auth/change_password/
  • /auth/reset_password_request/
  • /auth/reset_password_complete/

The username for the admin user is admin, and the password is pass.

Contributing

I am actively seeking contributions to this package. Check the "Issues" section of the repository for my current hit list.

If you have suggestions for other features I am open to hearing them. Use the "Issues" section of the repository to start a conversation.

Metadata

Release files for drf-advanced-auth 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for drf-advanced-auth 0.4.0
File Size Uploaded Provenance
drf_advanced_auth-0.4.0.tar.gz 11.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for drf-advanced-auth 0.4.0
File Interpreter ABI Platform
drf_advanced_auth-0.4.0-py3-none-any.whl Python 3 none any Details

Total release size: 25.4 kB

Release files / drf_advanced_auth-0.4.0.tar.gz

Download URL drf_advanced_auth-0.4.0.tar.gz
Size 11.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d6a7a6ed69ffff3cabbe287858a03ae08de0087ceab60f6e93831fa2a2420508
BLAKE2b-256 checksum
How to use checksums
b85111d8b698b80319c21b9bd0817ca513bdf080df7bd39b2015915abe551333
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.6

Release files / drf_advanced_auth-0.4.0-py3-none-any.whl

Download URL drf_advanced_auth-0.4.0-py3-none-any.whl
Size 14.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c21a1462855ab4174b654e79b0dc2df7c8462697d580d3b7eabcccd96497dff5
BLAKE2b-256 checksum
How to use checksums
a038002f626a1e94fa9c0c3e59a5927b8c4c340a7d64cb8560d3aacd55b221a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.8.6

Security for drf-advanced-auth 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page