oauth2-toolkit

Restrict spyne SOAP service with oauth2_provider

隐身守侯 提交于 2019-12-12 04:37:27
问题 I need to restrict some of my SOAP method so they can only be accessible with an Access Token. My SOAP service is running with Spyne and my OAuth2 provider comes from django-oauth2-toolkit. from django.contrib.auth.decorators import login_required from spyne.service import ServiceBase from spyne.decorator import srpc, rpc from oauth2_provider.views.generic import ProtectedResourceView class SOAPService(ProtectedResourceView, ServiceBase): @rpc(Unicode, _returns=Unicode) @login_required() def

How to access OAuth2 client_id in django rest framework?

↘锁芯ラ 提交于 2019-12-08 08:03:37
问题 I have my django rest framework API protected by Oauth2 toolkit, but I don't know how to get the client_id of the current authorized requests. class RequestTransactionView(APIView): def post(self, request, format=None): transaction = self.parse_dictionary(request.DATA) return Response(str(transaction.goid)) I have inspected the request object, which gave: ['DATA', 'FILES', 'QUERY_PARAMS', '_CONTENTTYPE_PARAM', '_CONTENT_PARAM', '_METHOD_PARAM', '__class__', '__delattr__', '__dict__', '__doc__