【发布时间】:2020-03-31 09:08:04
【问题描述】:
使用 Django REST Framework(DRF) 我可以像这样自定义Authentication class and Permission class
from django_cognito_jwt import JSONWebTokenAuthentication
from rest_framework import viewsets
from rest_framework.permissions import IsAuthenticated
class CognitoQuestionViewSet(viewsets.ModelViewSet):
authentication_classes = (JSONWebTokenAuthentication,)
permission_classes = (IsAuthenticated,)
queryset = Question.objects.all()
serializer_class = QuestionSerializer
在 GraphQL 中 docs。它使用与我的项目不同的标准 Django 登录。我检查了来源LoginRequiredMixin,但没有运气。我在那里看不到Authentication class,然后我可以覆盖它
问题:
如何自定义 GraphQL Authentication class and Permission class 就像我在 DRF 中所做的一样
【问题讨论】:
标签: django django-rest-framework graphql jwt amazon-cognito