feat(auth): add optional jwt parameter to getAuthenticatorAssuranceLevel#1940
Merged
Conversation
mandarini
requested changes
Jan 5, 2026
mandarini
left a comment
Contributor
There was a problem hiding this comment.
@7ttp thanks for this PR. Can you please:
- Add some tests for the new JWT code path. Should test:
- JWT with aal1, no factors returns aal1/aal1
- JWT with aal1, verified factors returns aal1/aal2
- Invalid JWT returns error
- JWT where getUser fails returns error - Fix the documentation mismatch. tsdoc says "rarely uses the network" but the new path calls getUser(jwt) which always makes a network request
After these are done, I will share with auth team to get final ok!
Contributor
|
@7ttp can you please rebase your PR with latest |
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.
Summary
Adds an optional
jwtparameter tomfa.getAuthenticatorAssuranceLevel(), enabling it to work in server side environments like Edge Functions where no session is stored.Problem
In Edge Functions,
getAuthenticatorAssuranceLevel()always returns{ currentLevel: null, nextLevel: null, currentAuthenticationMethods: [] }because it relies ongetSession()which reads from storage. Edge Functions don't have a stored session, only the JWT from the Authorization header.Solution
Added an optional
jwtparameter following the same pattern asgetUser(jwt?):closes #1677