【问题标题】:Why is it not possible to set options in IdentityServer?为什么无法在 IdentityServer 中设置选项?
【发布时间】:2021-04-25 04:40:41
【问题描述】:

我已尝试在 Startup.cs 上应用几种设置,如给定链接所示:

https://identityserver4.readthedocs.io/en/latest/quickstarts/2_interactive_aspnetcore.html

但不幸的是,当我检查以下 url 时,我无法设置权威参数的基本 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;
    });

【问题讨论】:

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


【解决方案1】:

像这样更改Authority 属性:

// base-address of your identityserver
.Authority = "https://my-pc-id:8085/_configuration/MyApp.WebUI";

【讨论】:

    猜你喜欢
    • 2016-05-14
    • 2023-01-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-03
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多