【问题标题】:OpenID Connect with ASP NET Core 3.1 without well-known URLOpenID Connect 与 ASP NET Core 3.1 没有众所周知的 URL
【发布时间】:2021-11-14 06:16:24
【问题描述】:

我正在尝试以这种方式使用 ASP.NET Core 3.1 配置 OpenID Connect:

 .AddOpenIdConnect(cfg =>
                {
                    cfg.Authority = "https://myurl.io";
                    cfg.ClientId = "123455555";
                    cfg.ClientSecret = "11111";
                    cfg.ResponseType = "code";
                    cfg.Scope.Clear();
                    cfg.Scope.Add("openid");
                });

但是当我尝试启动应用程序时,出现以下错误:

System.InvalidOperationException:IDX20803:无法从以下位置获取配置:'[PII 已隐藏。有关更多详细信息,请参阅 https://aka.ms/IdentityModel/PII。]'。

嗯,我知道这是因为我没有众所周知的 medadata url,有没有办法忽略这个 url 并在Startup.cs 中手动填写信息?

【问题讨论】:

  • "我没有众所周知的媒体数据 url" OIDC 提供程序不支持发现吗?

标签: asp.net-core asp.net-identity openid


【解决方案1】:

可以直接指定配置:

services
    .AddAuthentication()
    .AddOpenIdConnect(options => {
        options.Configuration = new OpenIdConnectConfiguration
        {
            JwksUri = "",
            AuthorizationEndpoint = "",
            TokenEndpoint = "",
            UserInfoEndpoint = "",
            Issuer = "",
            // ...
        };
    })

根据您的需要,您可能至少需要填写:

  • 授权端点
  • 令牌端点
  • 用户信息端点
  • 发行人
  • jwks 端点(或以不同方式执行验证)

【讨论】:

    猜你喜欢
    • 2021-11-15
    • 1970-01-01
    • 2018-12-12
    • 2021-10-02
    • 2020-05-08
    • 2021-03-02
    • 2023-02-21
    • 2021-05-31
    • 2018-07-03
    相关资源
    最近更新 更多