Skip to content

JSON Web Token based authentication for RIDI's django services

License

Notifications You must be signed in to change notification settings

ridi/django-jwt

Repository files navigation

django-jwt

Build Status PyPI PyPI - Python Version Coverage Status

Provides JSON Web Token based authentication for RIDI's micro services made with django

Installation

$ pip install ridi-django-jwt

Usage

In your settings.py, call configure function to specify token specs.

from ridi.django_jwt.config import configure

configure(
    key=open("key.pub", "rb"),
    audience='recommend',
    issuer='store',
    algorithm='RS256',
)

In your views.py, add jwt_required decorator to your view functions.

from ridi.django_jwt.decorators import jwt_required

@jwt_required()
def index(request):
    # ...

If you want to add JWT authentication to your Class-Based views, you can use mixin class instead.

from django.views.generic import TemplateView
from ridi.django_jwt.decorators import JWTRequiredMixin

class IndexView(JWTRequiredMixin, TemplateView):
    template_name = "index.html"

API

TBA

Todo

  • Provide authentication middleware
  • Add unit tests
  • Integrate with travis-ci

About

JSON Web Token based authentication for RIDI's django services

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages