简体   繁体   English

如何在 .NET Core 的 appSettings.json 上配置 IdentiyServer 设置?

[英]How to configure IdentiyServer settings on appSettings.json of .NET Core?

I use IdentityServer in my Angular app based on .NET Core and I am trying to set some of the parameters like client_id , redirect_uri , authority in appSettings.json file.我在基于 .NET Core 的 Angular 应用程序中使用 IdentityServer,我正在尝试在appSettings.json文件中设置一些参数,例如client_idredirect_uriauthority

"IdentityServer": {
  "Key": {
    "Type": "Development"
  },
  "Authentication": {
    "Authority": "localhost:8081",
    "ClientId": "localhost:8081",
    "AppIdUri": "localhost:8081"
  }
} 

So, how can I do this?那么,我该怎么做呢?

I need to set these parameters via appSettings.json and retrieve them when using the following url: https://localhost:8081/_configuration/DemoProject.Web I need to set these parameters via appSettings.json and retrieve them when using the following url: https://localhost:8081/_configuration/DemoProject.Web

You can call your settings in your code like this:您可以像这样在代码中调用您的设置:

string ClientId = Configuration["IdentityServer:Authentication:ClientId"];

I hope this helps.我希望这有帮助。 If it is not what you ment let me know.如果不是你说的,请告诉我。

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

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