From 4f220bdea818efa59bafaba6402cd33771ef800e Mon Sep 17 00:00:00 2001 From: Alan Zarembok Date: Tue, 1 Oct 2019 17:29:41 -0400 Subject: [PATCH] PROD-776: Update authentication_classes to use JWTAuthentication. --- edxval/views.py | 15 ++++++++------- setup.py | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/edxval/views.py b/edxval/views.py index 864f1131..716d4c21 100644 --- a/edxval/views.py +++ b/edxval/views.py @@ -11,7 +11,8 @@ from rest_framework.permissions import DjangoModelPermissions from rest_framework.response import Response from rest_framework.views import APIView -from rest_framework_oauth.authentication import OAuth2Authentication + +from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication from edxval.api import create_or_update_video_transcript from edxval.models import ( @@ -75,7 +76,7 @@ class VideoList(generics.ListCreateAPIView): """ GETs or POST video objects """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) permission_classes = (ReadRestrictedDjangoModelPermissions,) queryset = Video.objects.all().prefetch_related("encoded_videos", "courses") lookup_field = "edx_video_id" @@ -100,7 +101,7 @@ class VideoDetail(generics.RetrieveUpdateDestroyAPIView): """ Gets a video instance given its edx_video_id """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) permission_classes = (ReadRestrictedDjangoModelPermissions,) lookup_field = "edx_video_id" queryset = Video.objects.all() @@ -111,7 +112,7 @@ class VideoTranscriptView(APIView): """ A Transcription View, used by edx-video-pipeline to create video transcripts. """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) # noinspection PyMethodMayBeStatic def post(self, request): @@ -178,7 +179,7 @@ class VideoStatusView(APIView): was intended to only be used for video transcriptions but if you found it helpful to your needs, you can add more statuses so that you can use it for updating other video statuses too. """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) def patch(self, request): """ @@ -221,7 +222,7 @@ class VideoImagesView(APIView): """ View to update course video images. """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) def post(self, request): """ @@ -268,7 +269,7 @@ class HLSMissingVideoView(APIView): """ A View to list video ids which are missing HLS encodes and update an encode profile for a video. """ - authentication_classes = (OAuth2Authentication, SessionAuthentication) + authentication_classes = (JwtAuthentication, SessionAuthentication) def post(self, request): """ diff --git a/setup.py b/setup.py index 431057c2..ca57b6cc 100644 --- a/setup.py +++ b/setup.py @@ -44,7 +44,7 @@ def load_requirements(*requirements_paths): return list(requirements) -VERSION = '1.1.27' +VERSION = '1.1.28' if sys.argv[-1] == 'tag': print("Tagging the version on github:")