Python rest_framework.decorators 模块,authentication_classes() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用rest_framework.decorators.authentication_classes()

项目:occasions-server    作者:travisbloom    | 项目源码 | 文件源码
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
项目:django-netbox-graphql    作者:ninech    | 项目源码 | 文件源码
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