为什么无法在 IdentityServer 中设置选项?
Why is it not possible to set options in IdentityServer?
我已尝试在 Startup.cs 上应用几种设置,如给定的 link:
所示
https://identityserver4.readthedocs.io/en/latest/quickstarts/2_interactive_aspnetcore.html
但不幸的是,当我检查以下 url:
时,我无法为 Authority 参数设置基础 url
https://my-pc-id:8085/_configuration/MyApp.WebUI
好像很奇怪,如果我们不能设置这个参数,为什么这个配置上会有这样的选项?
using System.IdentityModel.Tokens.Jwt;
// ...
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "my-pc-id:8085";
options.ClientId = "mvc";
options.ClientSecret = "secret";
options.ResponseType = "code";
options.SaveTokens = true;
});
像这样更改 Authority
属性:
// base-address of your identityserver
.Authority = "https://my-pc-id:8085/_configuration/MyApp.WebUI";
我已尝试在 Startup.cs 上应用几种设置,如给定的 link:
所示https://identityserver4.readthedocs.io/en/latest/quickstarts/2_interactive_aspnetcore.html
但不幸的是,当我检查以下 url:
时,我无法为 Authority 参数设置基础 urlhttps://my-pc-id:8085/_configuration/MyApp.WebUI
好像很奇怪,如果我们不能设置这个参数,为什么这个配置上会有这样的选项?
using System.IdentityModel.Tokens.Jwt;
// ...
JwtSecurityTokenHandler.DefaultMapInboundClaims = false;
services.AddAuthentication(options =>
{
options.DefaultScheme = "Cookies";
options.DefaultChallengeScheme = "oidc";
})
.AddCookie("Cookies")
.AddOpenIdConnect("oidc", options =>
{
options.Authority = "my-pc-id:8085";
options.ClientId = "mvc";
options.ClientSecret = "secret";
options.ResponseType = "code";
options.SaveTokens = true;
});
像这样更改 Authority
属性:
// base-address of your identityserver
.Authority = "https://my-pc-id:8085/_configuration/MyApp.WebUI";