Skip to content
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
Copy Markdown
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