如何从appsettings.json文件中读取客户要求?
我有这个appsettings.json:
"IdentityServer": {
"Clients": [
{
"Enabled": true,
"ClientId": "client1",
"AlwaysSendClientClaims": true,
"Claims": [
{
"Type": "custom_claim1",
"Value": "value1"
},
{
"Type": "custom_claim2",
"Value": "value2"
}
]
}
]
}
然后,我加载客户端配置like the docs says:
var builder = services.AddIdentityServer(opts =>
{
/// Opts removed for simplicity
})
.AddInMemoryClients(Configuration.GetSection("IdentityServer:Clients"));
一切正常,除了客户要求。在Jwt.io解码工具中看不到它们。
答案 0 :(得分:0)
由于无法从json反序列化Claim对象的当前实现,因此从appSettings.json绑定Clients []中的Claims集合时出现问题。
https://github.com/IdentityServer/IdentityServer4/issues/2573
在这里