我们的 IdP 是 Salesforce.com 组织。SP 是第三方.Net 应用程序。在开发过程中,第 3 方报告他们无法验证发送的 SAML 响应。
我们决定尝试使用ComponentSpace来验证 SAML 响应。以下是我们尝试过的:
// Load the certificate from the file: certInFile
// Load the SAML in an XMLElement: samlXml
// Retrieve the certificate from the SAML: certInSaml
Console.WriteLine("SAML is valid ? " + SAMLResponse.IsValid(samlXml));
Console.WriteLine("Is SAML signed? " + SAMLMessageSignature.IsSigned(samlXml));
Console.WriteLine("Certificate found in SAML is same as certificate file? " + certInFile.Equals(certInSaml));
Console.WriteLine("Validated SAML with certificate found in SAML" + SAMLMessageSignature.Verify(samlXml, certInSaml));
Console.WriteLine("Validated SAML with certificate file" + SAMLMessageSignature.Verify(samlXml, certInFile));
除了最后两个之外,我对以上所有内容都是正确的。所以:
- SAML 有效
- SAML 具有有效的签名
- SAML中的公钥证书和我们的证书文件一样
- SAML 既不是使用证书文件的私钥,也不是使用 SAML 中发送的公钥
从 3,4 我们可以得出结论,Salesforce 正在签名,但使用不同的证书,但在响应中发送了错误的公钥?!
编辑:示例 SAML 在这里http://pastebin.com/J8FTxnhJ
我错过了什么?