在config.cs的IdentityServer4示例中,您有添加Client, IdentityResources, etc的代码,我想知道如何添加IdentityClaims。因为只有find选项才能添加客户端、IdentityResources、ApiResources。谁能给我指个正确的方向。谢谢
发布于 2019-03-18 01:22:35
如果我理解正确的话,那么您可能正在寻找一个新的IdentityResource来封装您的用户可能具有的某种自定义身份声明类型。下面是一个这样的例子:
return new List<IdentityResource>
{
//..Your other configured identity resources
new IdentityResource(
name: "custom.name",
displayName: "Custom Name",
claimTypes: new[] { "custom.name" });
};然后,您可以将其添加为用户声明:
new TestUser
{
SubjectId = "1",
Username = "alice",
Password = "password",
Claims = new []
{
new Claim("custom.name", "SomeCustomNameValue")
}
},https://stackoverflow.com/questions/55201487
复制相似问题