Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update authentication scheme from Token to JWT #1038

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
implement djangorestframework-simplejwt
  • Loading branch information
tomatoprinx committed Aug 14, 2021
commit 3365cf3ebba47643c6f501928e42026496a359cf
10 changes: 9 additions & 1 deletion requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,12 @@ pytest-xdist==1.31.0
cssselect==1.1.0

# PostgreSQL database adapter for the Python
psycopg2-binary==2.8.5
psycopg2-binary==2.8.5

# JSON Web Token implementation in Python
# https://pyjwt.readthedocs.io/en/stable/
PyJWT==1.7.1

# A JSON Web Token authentication plugin for the Django REST Framework.
# https://django-rest-framework-simplejwt.readthedocs.io/en/stable/
djangorestframework-simplejwt==4.4.0
3 changes: 2 additions & 1 deletion src/pycontw2016/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
url(r'^api/events/', include('events.api.urls', namespace="events")),
url(r'^set-language/$', set_language, name='set_language'),
url(r'^admin/', admin.site.urls),
url(r'^api/attendee/', include('attendee.api.urls'))
url(r'^api/attendee/', include('attendee.api.urls')),
url(r'api/token/', include('security.urls'))
]

# User-uploaded files like profile pics need to be served in development.
Expand Down
Empty file added src/security/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions src/security/urls.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
from django.urls import path
from rest_framework_simplejwt.views import (
TokenObtainPairView,
TokenRefreshView,
)


urlpatterns = [
path('', TokenObtainPairView.as_view(), name='token_obtain_pair'),
path('refresh/', TokenRefreshView.as_view(), name='token_refresh')
]