【问题标题】:How to configure IdentiyServer settings on appSettings.json of .NET Core?如何在 .NET Core 的 appSettings.json 上配置 IdentityServer 设置?
【发布时间】:2021-04-24 20:41:47
【问题描述】:

我在基于 .NET Core 的 Angular 应用程序中使用 IdentityServer,并尝试在 appSettings.json 文件中设置一些参数,例如 client_idredirect_uriauthority

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

那么,我该怎么做呢?

我需要通过appSettings.json设置这些参数,并在使用以下网址时检索它们:https://localhost:8081/_configuration/DemoProject.Web

【问题讨论】:

  • @user2250152 那是什么?我不使用亚马逊 AWS。
  • 还有人不知道 Identity Server 和 .NET Core 吗?
  • 您基本上是在问如何从appsettings.json 读取值吗? set these parameters via appSettings.json 到底是什么意思?澄清你的问题。
  • 我有点困惑,抱歉。但我需要通过appSettings.json 设置这些参数,并在使用以下网址时检索它们:https://localhost:8081/_configuration/DemoProject.Web。那么,这个url是否打开了appsettings.json中的参数呢?我不这么认为,但我只是设置了这些参数并通过这个 url 检索这些参数。有什么帮助吗?

标签: c# angular asp.net-core .net-core identityserver4


【解决方案1】:

您可以像这样在代码中调用您的设置:

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

我希望这会有所帮助。如果不是你说的,请告诉我。

【讨论】:

  • 感谢朋友,但我需要通过appSettings.json 设置这些参数,并在使用以下网址时检索它们:https://localhost:8081/_configuration/DemoProject.Web
  • 那你不能给他们一个api调用吗?所以你可以打电话给他们,把他们读出来,然后发回去?或者你现在是什么情况?
  • 对不起,我听不懂,因为我是 IdentityServer 的新手,很困惑。所以,我只是尝试使用appsettings.json 更改 IdentityServer 参数。
  • 我想你想更改launchsettings.json 这些是启动应用程序的设置。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-10-27
  • 1970-01-01
  • 1970-01-01
  • 2017-11-23
  • 1970-01-01
相关资源
最近更新 更多