snok / django-auth-adfs

A Django authentication backend for Microsoft ADFS and AzureAD
http://django-auth-adfs.readthedocs.io/
BSD 2-Clause "Simplified" License
270 stars 97 forks source link

Are claims available to Django Views in request to do custom permission check? #341

Open sachingaikwad123 opened 4 days ago

sachingaikwad123 commented 4 days ago

Client: React SPA Web API: Django Backend REST API Azure AD (only cloud)

I am able to test 'authentication' and 'web api call' with access token. I would like to implement RBAC in Django Backend Web APIs. For this, I am getting 'claims' in token as well. [I created app roles in Azure AD App Registration page for this].

  1. Now, I would like to do some custom permission checks in some 'views' (APIs) based on roles. How to access 'claims' value in 'views'? Should 'request.auth' have claims'? There is no documentation regarding this.
  2. What is recommended/best approach to implement RBAC in such setup? Should I map 'roles' to Django 'groups'? Can we add some documentation/help guide for this scenario using this django package/lib?

Upvote & Fund

Fund with Polar