File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -88,6 +88,25 @@ def get_obo_access_token(self, access_token):
88
88
logger .debug ("Received OBO access token: %s" , obo_access_token )
89
89
return obo_access_token
90
90
91
+ def get_group_memberships_from_ms_graph_params (self ):
92
+ """
93
+ Return the parameters to be used in the querystring
94
+ when fetching the user's group memberships.
95
+
96
+ Possible keys to be used:
97
+ - $count
98
+ - $expand
99
+ - $filter
100
+ - $orderby
101
+ - $search
102
+ - $select
103
+ - $top
104
+
105
+ Docs:
106
+ https://learn.microsoft.com/en-us/graph/api/group-list-transitivememberof?view=graph-rest-1.0&tabs=python#http-request
107
+ """
108
+ return {}
109
+
91
110
def get_group_memberships_from_ms_graph (self , obo_access_token ):
92
111
"""
93
112
Looks up a users group membership from the MS Graph API
@@ -105,6 +124,7 @@ def get_group_memberships_from_ms_graph(self, obo_access_token):
105
124
response = self ._ms_request (
106
125
action = provider_config .session .get ,
107
126
url = graph_url ,
127
+ data = self .get_group_memberships_from_ms_graph_params (),
108
128
headers = headers ,
109
129
)
110
130
claim_groups = []
Original file line number Diff line number Diff line change @@ -244,6 +244,12 @@ GROUPS_CLAIM
244
244
Name of the claim in the JWT access token from ADFS that contains the groups the user is member of.
245
245
If an entry in this claim matches a group configured in Django, the user will join it automatically.
246
246
247
+ If using Azure AD and there are too many groups to fit in the JWT access token, the application will
248
+ make a request to the Microsoft GraphQL API to find the groups. If you have many groups but only
249
+ need a specific few, you can customize the request by overriding
250
+ ``AdfsBaseBackend.get_group_memberships_from_ms_graph_params `` and specifying the
251
+ `OData query parameters <https://learn.microsoft.com/en-us/graph/api/group-list-transitivememberof?view=graph-rest-1.0&tabs=python#http-request >`_.
252
+
247
253
Set this setting to ``None `` to disable automatic group handling. The group memberships of the user
248
254
will not be touched.
249
255
You can’t perform that action at this time.
0 commit comments