Provides JSON Web Token based authentication for RIDI's micro services made with django
$ pip install ridi-django-jwt
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"
TBA
- Provide authentication middleware
- Add unit tests
- Integrate with travis-ci