【发布时间】:2020-11-09 09:56:45
【问题描述】:
我正在尝试在开发环境中使用其 ip 地址连接到开放 id 授权。显然,在这种情况下,ssl 验证将失败。我想绕过它,到目前为止没有任何运气。我找到了有关此主题的以下答案:
- 在 OpenIdConnectOptions 类中将 RequireHttpsMetadata 设置为 false。
- 使用下面的代码:
ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, sslPolicyErrors) => true;
当我的应用尝试访问 oidc 权限时,我收到了同样的错误:
处理请求时发生未处理的异常。 AuthenticationException:根据远程证书无效 到验证程序。 System.Net.Security.SslStream.StartSendAuthResetSignal(协议令牌 消息,AsyncProtocolRequest asyncRequest,ExceptionDispatchInfo 例外)
HttpRequestException:无法建立 SSL 连接,请参阅 内部异常。 System.Net.Http.ConnectHelper.EstablishSslConnectionAsyncCore(流 流,SslClientAuthenticationOptions sslOptions,CancellationToken 取消令牌)
IOException:IDX20804:无法从以下位置检索文档: 'https://172.11.0.11:1111/MY_APP/.well-known/openid-configuration'。 Microsoft.IdentityModel.Protocols.HttpDocumentRetriever.GetDocumentAsync(字符串 地址,CancellationToken 取消)
InvalidOperationException:IDX20803:无法获取配置 从: 'https://172.11.0.11:1111/MY_APP/.well-known/openid-configuration'。 Microsoft.IdentityModel.Protocols.ConfigurationManager.GetConfigurationAsync(CancellationToken 取消)
【问题讨论】:
-
没有办法禁用ssl验证,ssl握手总是存在的。我建议你可以提取服务器ssl证书并安装在开发环境中。
标签: asp.net-core ssl certificate openid openid-connect