Skip to content

added user email upn data in request session #364 #365

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 6 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions django_auth_adfs/backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,15 @@ def authenticate(self, request=None, authorization_code=None, **kwargs):

adfs_response = self.exchange_auth_code(authorization_code, request)
access_token = adfs_response["access_token"]

# Extract claims before user lookup
claims = self.validate_access_token(access_token)
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason you're not overriding validate_access_token in your code to achieve the logic you want?


# Store claims in session so it's available in login_failed()
if request and hasattr(request, "session"):
username_claim = settings.USERNAME_CLAIM
request.session["username_claim"] = claims[username_claim]

user = self.process_access_token(access_token, adfs_response)
return user

Expand Down
Loading