Asp.net-Mvc

ID4175:安全令牌的頒發者未被 IssuerNameRegistry 辨識

  • February 26, 2019

我正在嘗試在開發環境中與我的 MVC 應用程序一起實現一個簡單的 STS 網站。我能夠在我的本地機器上正常工作。我會導航到我的 MVC 應用程序,踢出到 STS Web 應用程序,我登錄,然後被重定向回我的 MVC 應用程序。順便說一句,這不是使用 AFDS。

當我將其遷移到我的開發環境時,我看到了類似的活動,但我在登錄時收到以下錯誤。我已經檢查了大約 20 次,我在 MVC 應用程序中的指紋與證書完全相同。

(登錄工作正常,因為在身份驗證成功之前我不會被重定向。)

有什麼猜測嗎?

我收到的錯誤消息:

ID4175:安全令牌的頒發者未被 IssuerNameRegistry 辨識。要接受來自此頒發者的安全令牌,請將 IssuerNameRegistry 配置為返回此頒發者的有效名稱

來自 STS 網站的 web.config:

<appSettings>
<add key="IssuerName" value="STSTestCert"/>
<add key="SigningCertificateName" value="CN=STSTestCert"/>
<add key="EncryptingCertificateName" value=""/>
 </appSettings>

來自 MVC 應用程序的 web.config:

<microsoft.identityModel>
<service>
 <audienceUris>
   <add value="http://localhost/" />
 </audienceUris>
 <federatedAuthentication>
   <wsFederation passiveRedirectEnabled="true" issuer="http://localhost:57543/mySTS/" realm="http://localhost/" requireHttps="false" />
   <cookieHandler requireSsl="false" />
 </federatedAuthentication>
 <applicationService>
   <claimTypeRequired>
     <!--Following are the claims offered by STS 'http://localhost:57543/mySTS/'. Add or uncomment claims that you require by your application and then update the federation metadata of this application.-->
     <claimType type="http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name" optional="true" />
     <claimType type="http://schemas.microsoft.com/ws/2008/06/identity/claims/role" optional="true" />
   </claimTypeRequired>
 </applicationService>
 <issuerNameRegistry type="Microsoft.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, Microsoft.IdentityModel, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
       <trustedIssuers>
     <add thumbprint="‎11111" name="http://localhost:57543/mySTS/" />
       </trustedIssuers>
     </issuerNameRegistry>
   </service>
 </microsoft.identityModel>

複製您的指紋會添加隱藏的 Unicode 字元。嘗試輸入它。

正如 MJCoffman 所說,這很可能是因為您複製了帶有隱藏字元的指紋。您可以在此處找到更多詳細資訊。

引用自:https://stackoverflow.com/questions/20339091