Merge pull request #26582 from edx/ciduarte/AA-664

AA-664: add JwtAuthentication to course home api
This commit is contained in:
Carla Duarte
2021-02-16 14:11:19 -05:00
committed by GitHub
2 changed files with 17 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ from rest_framework.response import Response
from opaque_keys.edx.keys import CourseKey
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
from edx_rest_framework_extensions.auth.session.authentication import SessionAuthenticationAllowInactiveUser
from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser
from common.djangoapps.student.models import CourseEnrollment
from lms.djangoapps.courseware.access import has_access
from lms.djangoapps.courseware.masquerade import setup_masquerade
@@ -50,6 +54,12 @@ class CourseHomeMetadataView(RetrieveAPIView):
* 404 if the course is not available or cannot be seen.
"""
authentication_classes = (
JwtAuthentication,
BearerAuthenticationAllowInactiveUser,
SessionAuthenticationAllowInactiveUser,
)
serializer_class = CourseHomeMetadataSerializer
def get(self, request, *args, **kwargs):

View File

@@ -30,6 +30,7 @@ from lms.djangoapps.courseware.courses import get_course_date_blocks, get_course
from lms.djangoapps.courseware.date_summary import TodaysDate
from lms.djangoapps.courseware.masquerade import setup_masquerade
from openedx.core.djangoapps.content.course_overviews.models import CourseOverview
from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser
from openedx.features.course_duration_limits.access import get_access_expiration_data
from openedx.features.course_experience import COURSE_ENABLE_UNENROLLED_ACCESS_FLAG
from openedx.features.course_experience.course_tools import CourseToolsPluginManager
@@ -138,6 +139,12 @@ class OutlineTabView(RetrieveAPIView):
"""
authentication_classes = (
JwtAuthentication,
BearerAuthenticationAllowInactiveUser,
SessionAuthenticationAllowInactiveUser,
)
serializer_class = OutlineTabSerializer
def get(self, request, *args, **kwargs):