Skip to content

Conversation

lldelisle
Copy link

Dear developpers,
When using the OpenIdConnectAuth class with a ADFS IdP I got an issue because the email and USERNAME_KEY was not part of the response but part of the id_token.
The changes I made propose to use the info from the id_token if the key is not present in the response.
I don't know if this makes sense or if this should be a new Class.

I don't know how to make a test for this.

Copy link

codecov bot commented Sep 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.05%. Comparing base (2612cdd) to head (0ef8e16).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1259   +/-   ##
=======================================
  Coverage   78.04%   78.05%           
=======================================
  Files         354      354           
  Lines       10915    10918    +3     
  Branches      481      483    +2     
=======================================
+ Hits         8519     8522    +3     
  Misses       2224     2224           
  Partials      172      172           
Flag Coverage Δ
unittests 78.05% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@@ -337,12 +337,19 @@ def user_data(self, access_token, *args, **kwargs):

def get_user_details(self, response):
username_key = self.setting("USERNAME_KEY", self.USERNAME_KEY)
# populate response with id_token if needed
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# populate response with id_token if needed

Comment on lines 347 to 353
return {
"username": response.get(username_key),
"email": response.get("email"),
"fullname": response.get("name"),
"first_name": response.get("given_name"),
"last_name": response.get("family_name"),
"username": user_details.get(username_key),
"email": user_details.get("email"),
"fullname": user_details.get("name"),
"first_name": user_details.get("given_name"),
"last_name": user_details.get("family_name"),
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't just return user_details work the same? It has all the keys now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants