Active directory IdentityServer和ADFS

Active directory IdentityServer和ADFS,active-directory,single-sign-on,adfs,identityserver3,Active Directory,Single Sign On,Adfs,Identityserver3,我正在尝试将IdentityServer设置为使用ADFS进行身份验证。流程将是: User->Custom app->IS->ADFS 我已经设置了几乎所有的东西,但我仍然停留在IS和ADF之间的通信上。用户似乎在ADFS中成功登录,但我收到一个错误: ID4037:无法从以下安全密钥标识符“SecurityKeyIdentifier”解析验证签名所需的密钥 当我回到IS的时候 很明显,一方或另一方的令牌签名证书存在问题。我试图找到一些解释不同证书之间关系的文档,但没有成功 现在,我在IS中有

我正在尝试将IdentityServer设置为使用ADFS进行身份验证。流程将是:

User->Custom app->IS->ADFS

我已经设置了几乎所有的东西,但我仍然停留在IS和ADF之间的通信上。用户似乎在ADFS中成功登录,但我收到一个错误:

ID4037:无法从以下安全密钥标识符“SecurityKeyIdentifier”解析验证签名所需的密钥

当我回到IS的时候

很明显,一方或另一方的令牌签名证书存在问题。我试图找到一些解释不同证书之间关系的文档,但没有成功

现在,我在IS中有一个自签名证书,它对令牌进行签名(使用IdentityServerOptions的SigningCertificate属性设置),我在ADFS中配置了一个AD证书来对令牌进行签名

有没有关于如何正确执行的指南或建议?这两者应该是相同的,还是我应该配置其他东西使其工作

编辑 使用Fiddler,我可以看到ADFS中的所有内容都运行良好,错误在于结果发布到IdentityServer时。wresult参数中发布的XML为:

<t:RequestSecurityTokenResponse xmlns:t="http://schemas.xmlsoap.org/ws/2005/02/trust">
  <t:Lifetime>
    <wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2017-06-20T12:25:31.148Z</wsu:Created>
    <wsu:Expires xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">2017-06-20T13:25:31.148Z</wsu:Expires>
  </t:Lifetime>
  <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>urn:identityServer</wsa:Address>
    </wsa:EndpointReference>
  </wsp:AppliesTo>
  <t:RequestedSecurityToken>
    <saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="_fd1a14cd-4d18-407b-97d4-9f9dfcacd29a" Issuer="http://ssosrv.mydomain.com/adfs/services/trust" IssueInstant="2017-06-20T12:25:31.148Z" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
      <saml:Conditions NotBefore="2017-06-20T12:25:31.148Z" NotOnOrAfter="2017-06-20T13:25:31.148Z">
        <saml:AudienceRestrictionCondition>
          <saml:Audience>urn:identityServer</saml:Audience>
        </saml:AudienceRestrictionCondition>
      </saml:Conditions>
      <saml:AttributeStatement>
        <saml:Subject>
          <saml:NameIdentifier>user@mydomain.com</saml:NameIdentifier>
          <saml:SubjectConfirmation>
            <saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod>
          </saml:SubjectConfirmation>
        </saml:Subject>
        <saml:Attribute AttributeName="emailaddress" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims">
          <saml:AttributeValue>name.surname@mydomain.tv</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute AttributeName="name" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims">
          <saml:AttributeValue>Name Surname</saml:AttributeValue>
        </saml:Attribute>
        <saml:Attribute AttributeName="upn" AttributeNamespace="http://schemas.xmlsoap.org/ws/2005/05/identity/claims">
          <saml:AttributeValue>user@mydomain.com</saml:AttributeValue>
        </saml:Attribute>
      </saml:AttributeStatement>
      <saml:AuthenticationStatement AuthenticationMethod="urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport" AuthenticationInstant="2017-06-20T12:25:31.039Z">
        <saml:Subject>
          <saml:NameIdentifier>user@mydomain.com</saml:NameIdentifier>
          <saml:SubjectConfirmation>
            <saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:bearer</saml:ConfirmationMethod>
          </saml:SubjectConfirmation>
        </saml:Subject>
      </saml:AuthenticationStatement>
      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:SignedInfo>
          <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
          <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256" />
          <ds:Reference URI="#_fd1a14cd-4d18-407b-97d4-9f9dfcacd29a">
            <ds:Transforms>
              <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature" />
              <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#" />
            </ds:Transforms>
            <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256" />
            <ds:DigestValue>6CeXXXXXXXXXXXXXXXXXXXX=</ds:DigestValue>
          </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>q9hJBFFFFFFFFFFFFFFFFFFFF==</ds:SignatureValue>
        <KeyInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
          <X509Data>
            <X509Certificate>MIIFnzXXXXXXXXXXXXXXXXXXXX</X509Certificate>
          </X509Data>
        </KeyInfo>
      </ds:Signature>
    </saml:Assertion>
  </t:RequestedSecurityToken>
  <t:TokenType>urn:oasis:names:tc:SAML:1.0:assertion</t:TokenType>
  <t:RequestType>http://schemas.xmlsoap.org/ws/2005/02/trust/Issue</t:RequestType>
  <t:KeyType>http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey</t:KeyType>
</t:RequestSecurityTokenResponse>

2017-06-20T12:25:31.148Z
2017-06-20T13:25:31.148Z
urn:identityServer
urn:identityServer
user@mydomain.com
urn:oasis:name:tc:SAML:1.0:cm:bearier
名称surname@mydomain.tv
姓名
user@mydomain.com
user@mydomain.com
urn:oasis:name:tc:SAML:1.0:cm:bearier
6CEXXXXXXXXXXXXXX=
Q9HJBFFFFFFFFFFFFFFFFFFF==
MIIFNZXXXXXXXXXXXXXX
urn:oasis:names:tc:SAML:1.0:assertion
http://schemas.xmlsoap.org/ws/2005/02/trust/Issue
http://schemas.xmlsoap.org/ws/2005/05/identity/NoProofKey
谢谢,, 阿尔伯特

记忆:

  • 您需要将IS证书转换为.cer格式
  • 在mmc中,右键单击证书和“所有任务”/“导出”
  • 单击导出向导,选择: “否,不导出私钥”。 “DER编码的二进制X.509(.CER)”
  • 选择要导出到的文件名并“保存”
  • 查看选项和“完成”
  • 在ADFS向导中,将.cer文件导入“证书”选项卡

    • 解决了这个问题。这与ADFS集成无关,但与我如何在Identity Server中设置联合身份验证有关。我使用了两个联邦身份验证提供程序:一个使用ADF,另一个使用WinAuth。在没有回调的情况下,来自ADFS的响应由WinAuth处理,因此我为它们中的每一个配置了不同的回调,并且它正在工作。

      我确实将其更改为在ADFS和IS中使用相同的证书,但仍然收到一个错误。在任何情况下,我寻找的更多的是一些文档/指南,而不是可能有效的特定解决方案,但我不知道为什么。请看下面:-您可能需要禁用吊销检查