簡體   English   中英

將Thinktecture IdentityServer3與SessionAuthenticationModule / WSFederationAuthenticationModule一起使用會引發ID4175錯誤

[英]Using Thinktecture IdentityServer3 with SessionAuthenticationModule/WSFederationAuthenticationModule throws ID4175 error

我正在嘗試連接我的應用程序IdentityServer3。 我正在使用SelfHost(帶有WS-Fed的InMem)示例。 登錄正常。 我得到一個不錯的saml令牌:

<trust:RequestSecurityTokenResponseCollection xmlns:trust="http://docs.oasis-open.org/ws-sx/ws-trust/200512">
  <trust:RequestSecurityTokenResponse Context="rm=1&amp;id=passive&amp;ru=%2f">
    <wsp:AppliesTo xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
      <wsa:EndpointReference xmlns:wsa="http://www.w3.org/2005/08/addressing">
        <wsa:Address>http://localhost:47483/</wsa:Address>
      </wsa:EndpointReference>
    </wsp:AppliesTo>
    <trust:RequestedSecurityToken>
      <Assertion ID="_3652b65f-1ec9-46bc-b441-0bbe58fac918" IssueInstant="2015-10-21T09:39:52.079Z" Version="2.0" xmlns="urn:oasis:names:tc:SAML:2.0:assertion">
        <Issuer>https://localhost:44333/core</Issuer>
        <Signature xmlns="http://www.w3.org/2000/09/xmldsig#">
          <SignedInfo>
            <CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            <SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
            <Reference URI="#_3652b65f-1ec9-46bc-b441-0bbe58fac918">
              <Transforms>
                <Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
                <Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
              </Transforms>
              <DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
              <DigestValue>CKB75sO/t4yKTxvWiexH07OxXF9MyfCiCHL/etC5FqY=</DigestValue>
            </Reference>
          </SignedInfo>
          <SignatureValue>Lrc3LECkvgPMjI...ZdvN0UaWPg==</SignatureValue>
          <KeyInfo>
            <X509Data>
                <X509Certificate>MIIDBTCCAfGgA...0CfXoW6iz1</X509Certificate>
            </X509Data>
          </KeyInfo>
        </Signature>
        <Subject>
          <SubjectConfirmation Method="urn:oasis:names:tc:SAML:2.0:cm:bearer" />
        </Subject>
        <Conditions NotBefore="2015-10-21T09:39:52.029Z" NotOnOrAfter="2015-10-21T09:40:52.029Z">
          <AudienceRestriction>
            <Audience>http://localhost:47483/</Audience>
          </AudienceRestriction>
        </Conditions>
        <AuthnStatement AuthnInstant="2015-10-21T09:39:52.026Z">
          <AuthnContext>
            <AuthnContextClassRef>urn:oasis:names:tc:SAML:2.0:ac:classes:Password</AuthnContextClassRef>
          </AuthnContext>
        </AuthnStatement>
      </Assertion>
    </trust:RequestedSecurityToken>
  </trust:RequestSecurityTokenResponse>
</trust:RequestSecurityTokenResponseCollection>

很好,但是我的應用顯示了黃色的死亡屏幕: 在此處輸入圖片說明

我的Web.config(摘錄)如下所示:

 <system.identityModel.services>
    <federationConfiguration>
      <wsFederation passiveRedirectEnabled="true" homeRealm=""  issuer="https://localhost:44333/core/wsfed" realm="http://localhost:47483/" requireHttps="false" persistentCookiesOnPassiveRedirects="true" />
      <cookieHandler requireSsl="false" persistentSessionLifetime="0.10:00:00" />
    </federationConfiguration>
  </system.identityModel.services>
  <system.identityModel>
    <identityConfiguration>
      <audienceUris>
        <add value="http://localhost:47483/" />
      </audienceUris>
      <certificateValidation certificateValidationMode="None" />
      <issuerNameRegistry type="System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry, System.IdentityModel, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089">
        <trustedIssuers>
          <add thumbprint="‎6b7acc520305bfdb4f7252daeb2177cc091faae1" name="https://localhost:44333/core" />
        </trustedIssuers>
      </issuerNameRegistry>
    </identityConfiguration>
  </system.identityModel>

我究竟做錯了什么? 有沒有辦法讓這個工作?

當然。 查看SAML斷言。 令牌中的發行者在這里:

<Issuer>https://localhost:44333/core</Issuer>

您的WSFed配置中發行者的驗證參數在這里:

<wsFederation passiveRedirectEnabled="true" homeRealm=""  issuer="https://localhost:44333/core/wsfed" realm="http://localhost:47483/" requireHttps="false" persistentCookiesOnPassiveRedirects="true" />

看起來您的Web配置的issuer屬性中有一個額外的/wsfed ,用於wsFederation元素。 如果將其刪除,我希望令牌隨后將生效。

問題似乎是System.IdentityModel.Tokens.ConfigurationBasedIssuerNameRegistry 我已經用我自己的替換了。 現在一切正常。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM