Identity.Name is always null on the client: the access token names the user in unique_name, the client reads name
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 75/100
- Issue 类型
- 缺陷
- 描述清晰度
- 描述清楚
- 活跃度
- 活跃
- 技术栈
- csharp
调研方向
从 IAuthTokenProvider.ParseAccessToken 开始,这里用 nameType: "name" 构建客户端的 ClaimsPrincipal,并将其与服务器写入的 claim 名称(unique_name)进行比较。查看 ClaimsPrincipalExtensions.GetUserName() 和 AuthManager.KeepActiveAccount,了解名称是如何读取的。当已登录用户在客户端上的 Identity.Name 不为 null,且现有的身份验证测试仍然通过时,即完成。
由索引模型根据 Issue 内容生成。
描述
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.
- 主要语言
- C#
- 星标
- 1.4k
- 派生
- 264
- 平均合并
- 8 小时 58 分钟
- 30 天内合并 PR
- 579
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
bitfoundation/bitplatform 的其他 Issue
-
area / templates
难度 2/5 1-3 小时 新手友好度 66/100
bitfoundation/bitplatform#15109 ·
维护者通常 1 天内回复
-
area / templates
难度 2/5 1-3 小时 新手友好度 65/100
bitfoundation/bitplatform#15108 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 25/100
bitfoundation/bitplatform#15105 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 12/100
bitfoundation/bitplatform#15100 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
bitfoundation/bitplatform#15097 ·
维护者通常 1 天内回复
查看 bitfoundation/bitplatform 的全部 Issue
相似的 Issue
-
ready-for-agent tech-debt
难度 1/5 1-3 小时 新手友好度 85/100
DigiBanks99/menlo#640 ·
维护者通常 1 天内回复
-
ci
难度 1/5 1 小时以内 新手友好度 62/100
OpenTabletDriver/OpenTabletDriver#5283 ·
维护者通常 3 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
维护者通常 1 天内回复
-
aikido critical security
难度 1/5 1 小时以内 新手友好度 72/100
dequelabs/axe-core-nuget#305 ·
-
:watch: Not Triaged dotnet-fundamentals/svc install/subsvc
难度 1/5 1 小时以内 新手友好度 72/100
维护者通常 1 天内回复