Skip to main content

Full authentication and credential management for Django REST Framework

Project description

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.

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

drf_advanced_auth-0.4.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

drf_advanced_auth-0.4.0-py3-none-any.whl (14.0 kB view details)

Uploaded Python 3

File details

Details for the file drf_advanced_auth-0.4.0.tar.gz.

File metadata

  • Download URL: drf_advanced_auth-0.4.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for drf_advanced_auth-0.4.0.tar.gz
Algorithm Hash digest
SHA256 d6a7a6ed69ffff3cabbe287858a03ae08de0087ceab60f6e93831fa2a2420508
MD5 b8d7e15f67637afe8357c0b0632a8538
BLAKE2b-256 b85111d8b698b80319c21b9bd0817ca513bdf080df7bd39b2015915abe551333

See more details on using hashes here.

File details

Details for the file drf_advanced_auth-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: drf_advanced_auth-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.0 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for drf_advanced_auth-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c21a1462855ab4174b654e79b0dc2df7c8462697d580d3b7eabcccd96497dff5
MD5 44ae5cd16a7f2f7188c00fd46cad4119
BLAKE2b-256 a038002f626a1e94fa9c0c3e59a5927b8c4c340a7d64cb8560d3aacd55b221a1

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