2016-07-25 55 views
1

以前已經詢問過這個問題,但我完全卡住了,到目前爲止還沒有其他問題已列入我的工作。雖然這是指身份服務器,但我認爲我錯過了設置SSL的事情。「根據驗證程序,遠程證書無效」

我已經設置如下(這是與IIS表達不完整的IIS):

我的錯誤就行標題:

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> { } 
} 

所有我的客戶有這樣的範圍。

感謝

+0

證書是否已明確添加到「計算機帳戶」的「受信任的根證書頒發機構」存儲中?你需要使用管理員權限運行'MMC.exe'並選擇'Computer Account' – Seany84

+0

嗨,我相信。我在窗口中,並且我爲auth.testhost.com和IIS Express使用的本地主機都提供了證書。 – user2330270

+0

您可以關閉當前的MMC窗口並使用管理員權限再次打開它,選擇計算機帳戶,並檢查證書是否仍然存在? – Seany84

回答

1

這個問題是固定的一切,但IdentityModel.Jwt升級到最新版本,這給了設置證書和發行人名稱上承載的選件。這兩個都需要設置爲錯誤消失

相關問題