django-auth-anywhere

django-auth-anywhere is a Django application which enables non-DRF views to authenticate using DRF backends.


Keywords
django, middleware, rest, framework, api, authentication, jwt
License
MIT
Install
pip install django-auth-anywhere==0.0.2

Documentation

django-auth-anywhere

django-auth-anywhere is a Django application which enables using Django Rest Framework authentication backends throughout your Django application. This can be useful to secure non-API endpoints behind token authentication using JSON web tokens.

Requirements

This has only been tested with:

  • Python: 3.5
  • Django: 1.8, 1.9, 1.10

Setup

Install from pip:

pip install django-auth-anywhere

and then add it to your installed apps:

INSTALLED_APPS = (
    ...
    'auth_anywhere',
    ...
)

You will also need to add a middleware class to listen in on responses:

MIDDLEWARE_CLASSES = [
    ...
    'auth_anywhere.middleware.AuthenticationMiddleware',
    'django.middleware.common.CommonMiddleware',
    ...
]

Credits

django-auth-anywhere was created by Morgante Pell (@morgante), with inspiration from Anthony Lobko (@amelius15).