简体   繁体   English

身份服务器4并未显示所有用户声明

[英]identity server 4 does not show all user claims

I'm using IdentityServer4 and everything is fine until I log in with some user, where all my user data does not appear. 我正在使用IdentityServer4,一切正常,直到我以某个用户登录,而我的所有用户数据都没有出现。

When entering a TestUser with the name, email, website, age, game-favorite Claims, it only displays the name and website. 输入名称,电子邮件,网站,年龄,最喜欢的游戏声明的TestUser时,仅显示名称和网站。

how do I display all the variants my user has? 如何显示用户拥有的所有变体?

return new List < TestUser > {
 new TestUser {
  SubjectId = "2",
   Username = "bob",
   Password = "password",
   Claims = new [] {
    new Claim("name", "Bob Asterman"),
     new Claim("e-mail", "bobasterman@gmail.com"),
     new Claim("website", "https://bob.com"),
     new Claim("idade", "25 anos"),
     new Claim("jogo-favorito", "nier-automata")
   }
 }
};

Sorry for the bad English. 对不起,英语不好。

The Claim idade is not included by default. 默认情况下不包括Claim idade you need to introduce this as a custom claim by adding it your Scopes in GetScopes method in the config.cs: 您需要通过在config.cs的GetScopes方法中将Scopes添加为自定义声明来引入此声明:

Then, you have to add this new scope to your Client using AllowedScopes Property in Config .cs example: 然后,您必须使用Config .cs示例中的AllowedScopes属性将此新范围添加到Client

AllowedScopes = { "idade"}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM