|
6 | 6 |
|
7 | 7 | * ADR 0025 – ``serializer_class`` on every viewset/view |
8 | 8 | * ADR 0026 – explicit ``authentication_classes`` + ``permission_classes`` |
| 9 | + * ADR 0034 – auth standardization (OEP-0042). All four v2 viewsets/views use |
| 10 | + ``(JwtAuthentication, EnrollmentCrossDomainSessionAuth)``; |
| 11 | + ``BearerAuthenticationAllowInactiveUser`` has been removed per the |
| 12 | + deprecation policy. ``EnrollmentCrossDomainSessionAuth`` is retained |
| 13 | + (rather than relying on the platform-default ``SessionAuthentication``) |
| 14 | + because these endpoints must accept cross-domain Studio/LMS CSRF-validated |
| 15 | + session cookies. |
9 | 16 | * ADR 0027 – ``drf_spectacular`` for OpenAPI schema generation |
10 | 17 | * ADR 0028 – consolidated into ``ViewSet`` classes registered via |
11 | 18 | ``DefaultRouter`` where the URL shape allows it |
|
70 | 77 | EnrollmentUserThrottle, |
71 | 78 | ) |
72 | 79 | from openedx.core.djangoapps.user_api.accounts.permissions import CanRetireUser |
73 | | -from openedx.core.lib.api.authentication import BearerAuthenticationAllowInactiveUser |
74 | 80 | from openedx.core.lib.api.mixins import StandardizedErrorMixin |
75 | 81 | from openedx.core.lib.api.permissions import ApiKeyHeaderPermissionIsAuthenticated |
76 | 82 |
|
@@ -209,9 +215,12 @@ class EnrollmentViewSet(StandardizedErrorMixin, viewsets.ViewSet, ApiKeyPermissi |
209 | 215 | DELETE /api/enrollment/v2/enrollment/enrollment_allowed/ → allowed (DELETE) |
210 | 216 | """ |
211 | 217 |
|
| 218 | + # ADR 0034 — JWT + cross-domain session (BearerAuthenticationAllowInactiveUser |
| 219 | + # removed per OEP-0042). EnrollmentCrossDomainSessionAuth retained because the |
| 220 | + # endpoint must accept cross-domain Studio/LMS CSRF-validated session cookies; |
| 221 | + # the platform-default SessionAuthentication would reject those. |
212 | 222 | authentication_classes = ( |
213 | 223 | JwtAuthentication, |
214 | | - BearerAuthenticationAllowInactiveUser, |
215 | 224 | EnrollmentCrossDomainSessionAuth, |
216 | 225 | ) |
217 | 226 | permission_classes = (ApiKeyHeaderPermissionIsAuthenticated,) |
@@ -417,9 +426,12 @@ def allowed(self, request): |
417 | 426 | class EnrollmentRetrieveView(StandardizedErrorMixin, ApiKeyPermissionMixIn, APIView): |
418 | 427 | """GET enrollment for a course (and optionally a named user).""" |
419 | 428 |
|
| 429 | + # ADR 0034 — JWT + cross-domain session (BearerAuthenticationAllowInactiveUser |
| 430 | + # removed per OEP-0042). EnrollmentCrossDomainSessionAuth retained because the |
| 431 | + # endpoint must accept cross-domain Studio/LMS CSRF-validated session cookies; |
| 432 | + # the platform-default SessionAuthentication would reject those. |
420 | 433 | authentication_classes = ( |
421 | 434 | JwtAuthentication, |
422 | | - BearerAuthenticationAllowInactiveUser, |
423 | 435 | EnrollmentCrossDomainSessionAuth, |
424 | 436 | ) |
425 | 437 | permission_classes = (ApiKeyHeaderPermissionIsAuthenticated,) |
@@ -492,9 +504,12 @@ def get(self, request, course_id=None, username=None): |
492 | 504 | class UserRolesView(StandardizedErrorMixin, APIView): |
493 | 505 | """List the current user's course-level roles.""" |
494 | 506 |
|
| 507 | + # ADR 0034 — JWT + cross-domain session (BearerAuthenticationAllowInactiveUser |
| 508 | + # removed per OEP-0042). EnrollmentCrossDomainSessionAuth retained because the |
| 509 | + # endpoint must accept cross-domain Studio/LMS CSRF-validated session cookies; |
| 510 | + # the platform-default SessionAuthentication would reject those. |
495 | 511 | authentication_classes = ( |
496 | 512 | JwtAuthentication, |
497 | | - BearerAuthenticationAllowInactiveUser, |
498 | 513 | EnrollmentCrossDomainSessionAuth, |
499 | 514 | ) |
500 | 515 | permission_classes = (ApiKeyHeaderPermissionIsAuthenticated,) |
@@ -644,9 +659,12 @@ def get(self, request, course_id=None): |
644 | 659 | class EnrollmentsAdminListView(StandardizedErrorMixin, ListAPIView): |
645 | 660 | """Admin-only paginated enrollment list with OEP-68 filter aliases.""" |
646 | 661 |
|
| 662 | + # ADR 0034 — JWT + cross-domain session (BearerAuthenticationAllowInactiveUser |
| 663 | + # removed per OEP-0042). EnrollmentCrossDomainSessionAuth retained because the |
| 664 | + # endpoint must accept cross-domain Studio/LMS CSRF-validated session cookies; |
| 665 | + # the platform-default SessionAuthentication would reject those. |
647 | 666 | authentication_classes = ( |
648 | 667 | JwtAuthentication, |
649 | | - BearerAuthenticationAllowInactiveUser, |
650 | 668 | EnrollmentCrossDomainSessionAuth, |
651 | 669 | ) |
652 | 670 | permission_classes = (permissions.IsAdminUser,) |
|
0 commit comments