Skip to content
JSON Web Token based authentication for RIDI's django services
Python
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

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
You can’t perform that action at this time.