The ony use is a GET request in admin portal so this view need not be post/put friendly right now. It may actually get removed in an upcoming iteration, or stay readonly. Fixes: SEC-1418 Co-authored-by: Binod Pant <bpant@edx.org>
32 lines
968 B
Python
32 lines
968 B
Python
"""
|
|
Viewset for auth/saml/v0/saml_configuration
|
|
"""
|
|
|
|
from edx_rest_framework_extensions.auth.jwt.authentication import JwtAuthentication
|
|
from rest_framework import permissions, viewsets
|
|
from rest_framework.authentication import SessionAuthentication
|
|
|
|
from ..models import SAMLConfiguration
|
|
from .serializers import SAMLConfigurationSerializer
|
|
|
|
|
|
class SAMLConfigurationMixin:
|
|
authentication_classes = (JwtAuthentication, SessionAuthentication,)
|
|
permission_classes = (permissions.IsAuthenticated,)
|
|
serializer_class = SAMLConfigurationSerializer
|
|
|
|
|
|
class SAMLConfigurationViewSet(SAMLConfigurationMixin, viewsets.ReadOnlyModelViewSet):
|
|
"""
|
|
A View to handle SAMLConfiguration GETs
|
|
|
|
Usage:
|
|
GET /auth/saml/v0/saml_configuration/
|
|
"""
|
|
|
|
def get_queryset(self):
|
|
"""
|
|
Find and return all saml configurations that are listed as public.
|
|
"""
|
|
return SAMLConfiguration.objects.current_set().filter(is_public=True)
|