mirror of
https://github.com/franjsco/segnalibre-backend
synced 2025-02-16 11:31:36 +01:00
Implement JWT Authentication
This commit is contained in:
parent
e86c62e5bb
commit
a181de664f
@ -2,9 +2,11 @@ astroid==2.3.3
|
||||
Django==2.2.7
|
||||
django-cors-headers==3.2.0
|
||||
djangorestframework==3.10.3
|
||||
djangorestframework-simplejwt==4.3.0
|
||||
isort==4.3.21
|
||||
lazy-object-proxy==1.4.3
|
||||
mccabe==0.6.1
|
||||
PyJWT==1.7.1
|
||||
pylint==2.4.4
|
||||
pytz==2019.3
|
||||
six==1.13.0
|
||||
|
@ -128,6 +128,12 @@ CORS_ORIGIN_WHITELIST = [
|
||||
]
|
||||
|
||||
REST_FRAMEWORK = {
|
||||
'DEFAULT_AUTHENTICATION_CLASSES': [
|
||||
'rest_framework_simplejwt.authentication.JWTAuthentication'
|
||||
],
|
||||
'DEFAULT_PERMISSION_CLASSES': (
|
||||
'rest_framework.permissions.IsAuthenticated'
|
||||
),
|
||||
'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.PageNumberPagination',
|
||||
'PAGE_SIZE': 10
|
||||
}
|
@ -1,5 +1,9 @@
|
||||
from django.urls import path, include
|
||||
from . import views
|
||||
from rest_framework_simplejwt.views import (
|
||||
TokenObtainPairView,
|
||||
TokenRefreshView,
|
||||
TokenVerifyView)
|
||||
|
||||
prefix = 'v1/'
|
||||
|
||||
@ -7,5 +11,8 @@ urlpatterns = [
|
||||
path(prefix + 'users/', views.UserList.as_view()),
|
||||
path(prefix + 'books/', views.BookList.as_view()),
|
||||
path(prefix +'books/<int:pk>/', views.BookDetail.as_view()),
|
||||
path('api-auth/', include('rest_framework.urls'))
|
||||
path('api-auth/', include('rest_framework.urls')),
|
||||
path(prefix + 'auth/token', TokenObtainPairView.as_view(), name='token_obtain_pair'),
|
||||
path(prefix + 'auth/refresh', TokenRefreshView.as_view(), name='token_refresh'),
|
||||
path(prefix + 'auth/verify', TokenVerifyView.as_view(), name='token_verify')
|
||||
]
|
Loading…
x
Reference in New Issue
Block a user