🚧(backend) return groups when requesting the resource server

Work in progress code, used during last Monday demo.
I will need to iterate.
This commit is contained in:
lebaudantoine
2024-05-31 18:15:00 +02:00
parent e4da9b23cd
commit e502368c8b
+10 -1
View File
@@ -42,4 +42,13 @@ class DataView(APIView):
def get(self, request):
"""Temporary route to test resource server authentication."""
token = request.auth
return Response(token)
if 'groups' in token.get('scope'):
# TODO - return a proper error
Response({'error scope "groups" not requested to the authorization server'})
slugs = [team.slug for team in request.user.teams.all()]
# TODO - use SCIM specification to exchange data
return Response({
"groups": slugs
})