【问题标题】:Disabling certificate validation for identityserver4禁用 identityserver4 的证书验证
【发布时间】:2021-08-04 06:20:31
【问题描述】:

我有 IdentityServer4 和 MVC 核心应用程序和 React 作为客户端。在本地主机上一切正常,但是一旦我尝试在 docker ubuntu 中部署所有内容,我就会遇到证书问题

System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch, RemoteCertificateChainErrors.

React 应用完美运行,但 mvc 无法从 .well-known/opendid-configuration 获取配置。我知道这个麻烦是由自签名证书引起的。我尝试使用dotnet dev-certs https -ep... 创建证书。但它没有用。所以现在我想禁用证书检查。当我尝试使用config.RequireHttpsMetadata = false; 禁用元数据时,我该怎么做?我也知道我可以使用禁用 CertificateValidation

ServicePointManager.ServerCertificateValidationCallback = (s, certificate, chain, sslPolicyErrors) => true;

但我不知道如何调用这个委托?

也许还有其他可能的方法来解决这个问题?

【问题讨论】:

标签: certificate ssl-certificate identityserver4


【解决方案1】:

尝试使用openssl 创建正确的签名证书:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365

openssl pkcs12 -export -out keyStore.p12 -inkey key.pem -in cert.pem

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-11-04
    • 2019-08-08
    • 2019-06-28
    • 1970-01-01
    相关资源
    最近更新 更多