我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用rest_framework.decorators.authentication_classes()。
def wrap_as_django_rest_framework_view(cls, *args, **kwargs): view = cls.as_view(*args, **kwargs) view = permission_classes((IsAuthenticated,))(view) view = authentication_classes(cls.get_view_authentication_classes())(view) view = api_view(['POST', 'GET'])(view) return view
def as_view(cls, *args, **kwargs): view = super(DRFAuthenticatedGraphQLView, cls).as_view(*args, **kwargs) view = permission_classes((IsAuthenticated,))(view) view = authentication_classes(api_settings.DEFAULT_AUTHENTICATION_CLASSES)(view) view = api_view(['GET', 'POST'])(view) return view