-
Notifications
You must be signed in to change notification settings - Fork 419
Export filterDefaultIdTokenClaims and update beforeSessionSaved docs #2119
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
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2119 +/- ##
=======================================
Coverage 82.61% 82.61%
=======================================
Files 21 21
Lines 2042 2042
Branches 358 358
=======================================
Hits 1687 1687
Misses 348 348
Partials 7 7 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
refactor fixes
43b58eb
to
5dc224c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changes LGTM, just left a small comment 👍 It might be worth considering exporting DEFAULT_ALLOWED_CLAIMS
to allow the developer to implement their own filter method based on the default profile claims.
📋 Changes
We have the following code here:
What we can see here is that if the user does not pass a
beforeSessionSaved
handler, thesession.user
is set to a filtered list of claims to only contain the default tokens.However, when a
beforeSessionSaved
handler is passed, the claims aren't filtered, and thesession.user
object passed tothis.beforeSessionSaved
has a non-filtered list of claims.This means, that the following code would include all claims:
However, this isn't clear from the docs. Additionally, if a user wants to only include a single claim, they currently need to ensure they provide all the default claims manually:
This is way to complicated and not the kind of experience we want. Therefore this PR exports the
filterClaims
(and renames it tofilterDefaultIdTokenClaims
, so it can be used in custombeforeSessionSaved
handlers accordingly.📎 References
🎯 Testing