[Feature] Add Azure AD Group Memberships to User Metadata
This PR updates the oauth_providers.py file to include Azure Active Directory (Azure AD) group memberships in the user metadata.
The following changes were made:
- Fetch Group Memberships: Added logic to retrieve group memberships using the Microsoft Graph API.
- Error Handling: Implemented a try-except block to gracefully handle any errors during the group membership fetch process.
- User Metadata Update: Updated the User object to include the fetched group memberships under the groups key in the metadata.
Testing:
- Verified that group memberships are correctly fetched and added to the user metadata.
- Tested error handling to ensure the application continues to function if the group membership fetch fails.
Dependencies:
- No new dependencies were added.
Notes:
- This change ensures that user group memberships are available for downstream processes that rely on user metadata.
- Backward compatibility is maintained as errors during group membership fetch are ignored.
@parthbs can we put this under a Boolean parameter in @cl.login? My company has 10s of thousands of groups for some reason and this could blow up the metadata for some.
@willydouhard can you check this PR now?
I see that you initialise a user_data variable but I was talking about user_group
@parthbs you can retrieve group memberships using the token this already retrieves. No need to force this into the framework when most users won't need this.