Syk/refactor auth checker functions - #97
Open
itsoyou wants to merge 3 commits into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #97 +/- ##
==========================================
- Coverage 76.35% 76.13% -0.23%
==========================================
Files 9 9
Lines 791 796 +5
Branches 146 156 +10
==========================================
+ Hits 604 606 +2
+ Misses 131 130 -1
- Partials 56 60 +4
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SYN-116
Note
Medium Risk
Touches all password-auth token login paths (JWT/OIDC/OAuth/EPA); changes are structural but errors in claim reconciliation or JWT verification could block or mis-associate logins.
Overview
Refactors the Synapse token authenticator so JWT, OIDC, OAuth, and EPA login paths share the same building blocks instead of duplicating login-type checks, token extraction, and JWT parsing.
Shared helpers in
TokenAuthenticatorinclude_acquire_token_data,_veryfiy_jwt(centralizedValueError/JWException/TypeErrorhandling), and_localpart_from_username/_fq_uid_from_usernamefor OAuth username reconciliation.Claim handling moves into
utils:get_claim_from_validation,get_reconciled_claim, andget_reconcile_claim_pathsreplace inlineif_not_none/get_path_in_dictloops in OAuth (and EPA for localpart/displayname). Docstrings are added for several existing utils.Tests add broad coverage for the new reconciliation helpers in
test_sta_utils.py. OIDC drops a redundantuser_id_strreassignment before success return; behavior should match the earlier flow whereuser_id_strwas already derived fromusername.Reviewed by Cursor Bugbot for commit a7e9a4c. Bugbot is set up for automated code reviews on this repo. Configure here.