Identity.Name is always null on the client: the access token names the user in unique_name, the client reads name
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp
- Domain
- authentication
Research direction
Start at IAuthTokenProvider.ParseAccessToken, where the client's ClaimsPrincipal is built with nameType: "name", and compare it with the claim name the server writes (unique_name). Check ClaimsPrincipalExtensions.GetUserName() and AuthManager.KeepActiveAccount to see how the name is read. Done when Identity.Name is non-null for a signed-in user on the client, and the existing authentication tests still pass.
Written by the indexing model from the issue text.
Description
The server writes the access token with JwtSecurityTokenHandler, which writes ClaimTypes.Name under its short name unique_name (its DefaultOutboundClaimTypeMap). IAuthTokenProvider.ParseAccessToken builds the client's ClaimsPrincipal with nameType: "name", so on the client Identity.Name is null for every signed-in user.
The client's authentication state comes from that principal, so context.User.Identity.Name in an AuthorizeView and AuthenticationState.User.Identity.Name are null as well. In the template itself, AuthManager.KeepActiveAccount takes the kept account's UserName from it, so an account whose profile hasn't been loaded is kept with no user name. Most of the template doesn't notice, because ClaimsPrincipalExtensions.GetUserName() reads both ClaimTypes.Name and unique_name.
The parsed principal's name type should be the claim the server writes, so Identity.Name holds the user's name on the client as it does on the server.
- Dominant language
- C#
- Stars
- 1.4k
- Forks
- 264
- Avg merge
- 8h 58m
- Merged PRs (30d)
- 579
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bitfoundation/bitplatform
-
area / templates
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
bitfoundation/bitplatform#15109 ·
Maintainers usually reply within 1 day
-
area / templates
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
bitfoundation/bitplatform#15108 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
bitfoundation/bitplatform#15105 ·
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 12/100
bitfoundation/bitplatform#15100 ·
Maintainers usually reply within 1 day
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
bitfoundation/bitplatform#15097 ·
Maintainers usually reply within 1 day
All issues in bitfoundation/bitplatform
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Natvs/Nt.Automaton#33 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
a-corriger documentation
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
christian-raj/S-Aloha#312 ·
-
ready-for-agent tech-debt
Difficulty 1/5 1-3 hours Newbie friendliness 85/100
DigiBanks99/menlo#640 ·
Maintainers usually reply within 1 day
-
ci
Difficulty 1/5 Under an hour Newbie friendliness 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
Maintainers usually reply within 3 days