Make the user object a dynamic claim set - #19
Merged
Conversation
Claims are configured per deployment, so the SDK no longer maps a fixed list of fields off the token. User now carries the claims as sent, exposes them by key and keeps the well known ones as accessors, matching the JavaScript SDK's KnownUser. The Quickstart profile screen lists every claim except the protocol ones instead of just the user ID and username, and resolves the display name from the claims it has. Signed-off-by: Brion <info@brionmario.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
11 tasks
rajithacharith
approved these changes
Aug 24, 2026
11 tasks
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.
Purpose
The profile screen in the Quickstart sample showed only the user ID and username, even when the signed in user had a first name, last name, mobile number and profile picture on their token. It also rendered the heading as "Guest" for users who have a first name and last name but no single combined name attribute.
The cause was in the SDK rather than the sample:
Userdeclared a fixed list of fields and the client hand picked claims into them, so any attribute a deployment configures beyond that list was dropped before the app could see it.Approach
Useris now the claim set itself. It holds the claims exactly as the server sent them,subscript(claim:)reads any of them, andsub,username,email,displayName,givenNameandfamilyNameare accessors that read the claim of the same name and nothing else. There are no fallback chains and no composed values, which mirrorsKnownUserin the JavaScript SDK.Codablemoved to a single value container so a userinfo or SCIM response lands in the claim set whole.profileClaimsreturns the claims withreservedClaimsremoved. That set holds only protocol claims, the ones describing the token rather than the user:sub,iss,aud,exp,iat,nbf,jti,azp,nonce,typ,at_hash,c_hash,sid,scope,client_id,acr,amrandauth_time. Everything else reaches the app.ThunderIDClientmaps nothing now. Both the token path ingetUser()and the sign in path constructUser(claims:).Name and avatar precedence stays in the presentation layer where it already lived, so
UserAvatarkeeps deciding how to seed initials and which claim to use for a picture. The sample's profile screen iteratesprofileClaims, humanises each key for its label (given_namebecomes "Given Name") and formats values by type, so a newly configured attribute shows up without a code change.Related Issues
Related PRs
Checklist
breaking changelabel added.Security checks