IdentityServer4 read client claims from appsettings.json

Viewed 1681

how can I read client claims from the appsettings.json file?

I have this appsettings.json:

"IdentityServer": {
     "Clients": [
       {
         "Enabled": true,
         "ClientId": "client1",
         "AlwaysSendClientClaims": true,
         "Claims": [
           {
             "Type": "custom_claim1",
             "Value": "value1"
           },
           {
             "Type": "custom_claim2",
             "Value": "value2"
           }
         ]
       }
     ]
}

And, I load the clients config like the docs says:

var builder = services.AddIdentityServer(opts =>
{
    /// Opts removed for simplicity
})
   .AddInMemoryClients(Configuration.GetSection("IdentityServer:Clients"));

All is working fine, except for the client claims. I can not see them in Jwt.io decode tool.

1 Answers
Related