我们的 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" …Run Code Online (Sandbox Code Playgroud)