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

JWT-based authentication for feedback and content curation request forms #561

Draft
wants to merge 4 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 4 additions & 0 deletions config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"django_celery_beat",
"rest_framework_datatables",
"rest_framework",
"rest_framework_simplejwt.token_blacklist",
]

CORS_ALLOWED_ORIGINS = [
Expand Down Expand Up @@ -333,6 +334,9 @@
"DEFAULT_PAGINATION_CLASS": "rest_framework_datatables.pagination.DatatablesPageNumberPagination",
"PAGE_SIZE": 50,
"EXCEPTION_HANDLER": "sde_indexing_helper.utils.exceptions.custom_exception_handler",
"DEFAULT_AUTHENTICATION_CLASSES": (
"rest_framework_simplejwt.authentication.JWTAuthentication",
),
}

GITHUB_ACCESS_TOKEN = env("GITHUB_ACCESS_TOKEN")
Expand Down
9 changes: 9 additions & 0 deletions feedback/urls.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.urls import path
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from .views import ContactFormModelView, ContentCurationRequestView

Expand All @@ -10,4 +11,12 @@
ContentCurationRequestView.as_view(),
name="content-curation-request-api",
),
path(
"contact-us-api/token/", TokenObtainPairView.as_view(), name="token-obtain-pair"
),
path(
"content-curation-request-api/token/refresh/",
TokenRefreshView.as_view(),
name="token-refresh",
),
]
3 changes: 3 additions & 0 deletions feedback/views.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from rest_framework import generics
from rest_framework.permissions import IsAuthenticated

from .models import ContentCurationRequest, Feedback
from .serializers import ContentCurationRequestSerializer, FeedbackSerializer
Expand All @@ -7,8 +8,10 @@
class ContactFormModelView(generics.CreateAPIView):
queryset = Feedback.objects.all()
serializer_class = FeedbackSerializer
permission_classes = [IsAuthenticated]


class ContentCurationRequestView(generics.CreateAPIView):
queryset = ContentCurationRequest.objects.all()
serializer_class = ContentCurationRequestSerializer
permission_classes = [IsAuthenticated]
1 change: 1 addition & 0 deletions requirements/base.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ scrapy==2.11.0
tqdm==4.65.0
xmltodict==0.13.0
django-cors-headers==4.3.1
djangorestframework-simplejwt==5.3.1