IdentityServer and ADFS

I am trying to configure IdentityServer to use ADFS for authentication. The stream will be:

User -> Custom Application -> IS -> ADFS

I have configured almost everything, but I am stuck with the connection between IS and ADFS. The user seems to have successfully logged into ADFS, but I get the error:

ID4037: The key required to verify the signature cannot be resolved from the following security key ID "SecurityKeyIdentifier

when I return to IS.

Obviously there is a problem with token signing certificates in one direction or another. I tried unsuccessfully to find documentation explaining the relationship between the various certificates.

I currently have my own certificate in IS that signs tokens (configured using the SigningCertificate IdentityServerOptions property) and I have an AD certificate configured in ADFS to sign tokens.

Is there any guidance or recommendation on how to do this correctly? Should it be the same in both or do I need to tweak something else to make it work?

EDIT With Fiddler I can see that everything inside ADFS is working fine, and the error is when the results are sent to IdentityServer. XML sent in wresult parameter:

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

      

Thanks Albert

+3


source to share


2 answers


I decided. This is not related to ADFS integration, but how did I set up federation authentication in Identity Server. I have used two federation authentication identity providers, this one with ADFS and the other using WinAuth. With no callback, the response from ADFS was handled by WinAuth, so I set up different callbacks for each one and it worked.



+5


source


From memory:



  • You need to convert the IS certificate to .cer format.
  • In mmc, right click on the certificate and "All Tasks" / "Export".
  • Select the Export Wizard by choosing "No, don't export the private key." "DER encoded X.509 binary (.CER)".
  • Select a filename to export and "Save".
  • View Options and Finish.
  • In the ADFS wizard, import the .cer file to the Certificates tab.
+2


source







All Articles