“根据验证程序,远程证书无效”
以前已经询问过这个问题,但我完全卡住了,到目前为止还没有其他问题已列入我的工作。虽然这是指身份服务器,但我认为我错过了设置SSL的事情。“根据验证程序,远程证书无效”
我已经设置如下(这是与IIS表达不完整的IIS):
- Identity Server的应用程序:auth.testhost.com:44373/core
- 的Web API服务:https://localhost:44356/
我的错误就行标题:
app.UseIdentityServerBearerTokenAuthentication(options);
这是巴在auth.testhost.com:44373/core/.well-known/openid-configuration上从服务器上请求一些打开的配置选项。
我的选择是:
Authority = "https://auth.testhost.com:44373/core",
RequiredScopes = new List<string>() { "api" }
在一些例子中我看到客户端ID和秘密,但他们不是在为我的选择:这是一个问题?
如果你需要看到任何身份服务器选项,请说,我会发布。 我跑到下面的命令来创建一个证书:
makecert.exe -r -pe -n "CN=auth.testhost.com" -b 01/01/2000 -e 01/01/2036 -eku 1.3.6.1.5.5.7.3.1 -ss my -sr localMachine -sky exchange -sp "Microsoft RSA SChannel Cryptographic Provider" -sy 12 -len 2048
这生成的证书,这是我然后出口到受信任的根证书颁发机构。
从我所知道的情况来看,SSL端口绑定应该由Visual Studio在我使用IIS Express时处理。下面是它具有绑定:
<site name="Authenticator_V2" id="2">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="c:\users\user\documents\visual studio 2015\Projects\Authenticator_V2\Authenticator_V2" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:49755:localhost" />
<binding protocol="https" bindingInformation="*:44373:localhost" />
<binding protocol="https" bindingInformation="*:44373:auth.testhost.com" />
</bindings>
</site>
<site name="APIClient2" id="7">
<application path="/" applicationPool="Clr4IntegratedAppPool">
<virtualDirectory path="/" physicalPath="C:\Users\user\documents\visual studio 2015\Projects\Authenticator_V2\APIClient2" />
</application>
<bindings>
<binding protocol="http" bindingInformation="*:53812:localhost" />
<binding protocol="https" bindingInformation="*:44356:localhost" />
</bindings>
</site>
这是我的hosts文件:
127.0.0.1 localhost
127.0.0.1 hybrid.testhost.com
127.0.0.1 auth.testhost.com
当我去https://auth.testhost.com:44373/我还有通过我的协议的红线。我认为这意味着仍然没有正确配置某些东西。我使用的Chrome和点击证书上给出了:
"Your connection to this site is not private."
详情:
SHA-1 Certificate
The certificate for this site expires in 2017 or later, and the certificate chain contains a certificate signed using SHA-1.
View certificate
Certificate Error
There are issues with the site's certificate chain (net::ERR_CERT_COMMON_NAME_INVALID).
我看着ERR_CERT_COMMON_NAME_INVALID错误,似乎是Chrome错误。然而,我的错误是从Web服务服务器试图连接到验证服务器,所以我想我可以忽略这一个?
我也跑的netsh检查有绑定建立一个证书:
netsh http show sslcert ipport=0.0.0.0:44373
SSL Certificate bindings:
-------------------------
IP:port : 0.0.0.0:44373
Certificate Hash : HAS ODD HASH - REMOVED
Application ID : {HAS GUID - REMOVED}
Certificate Store Name : MY
Verify Client Certificate Revocation : Enabled
Verify Revocation Using Cached Client Certificate Only : Disabled
Usage Check : Enabled
Revocation Freshness Time : 0
URL Retrieval Timeout : 0
Ctl Identifier : (null)
Ctl Store Name : (null)
DS Mapper Usage : Disabled
Negotiate Client Certificate : Disabled
Reject Connections : Disabled
在这一点上注意到了这个散列是不是我的证书是正确的。它用于IIS Express本地主机。我发现这个链接:IdentityServer: The remote certificate is invalid according to the validation procedure并复制了将本地主机证书移入受信任根证书颁发机构的步骤,但不幸的是我仍然有错误。我现在不确定还有什么要做。
范围配置:
new Scope
{
Name = "api",
DisplayName = "Can call API",
Enabled = true,
Type = ScopeType.Resource
//ScopeSecrets = new List<Secret> { }
}
所有我的客户有这样的范围。
感谢
这个问题是固定的一切,但IdentityModel.Jwt升级到最新版本,这给了设置证书和发行人名称上承载的选件。这两个都需要设置为错误消失
证书是否已明确添加到“计算机帐户”的“受信任的根证书颁发机构”存储中?你需要使用管理员权限运行'MMC.exe'并选择'Computer Account' – Seany84
嗨,我相信。我在窗口中,并且我为auth.testhost.com和IIS Express使用的本地主机都提供了证书。 – user2330270
您可以关闭当前的MMC窗口并使用管理员权限再次打开它,选择计算机帐户,并检查证书是否仍然存在? – Seany84