Subject: Constructing a Saml2.Response from Xml
Date: 2013-08-29 16:58:38
From: Dan Sullivan
Source: constructing-saml2-response-xml
----------------------------------------------------------------------

Hello - 

I have a few layers to my application and I'm hoping I can pass around the Assertions as a string or XmlDocument.  However, in doing so the Validate() method always returns false.  Here is a quick bit of code that illustrates my issue:

[code lang='c#']

Atp.Saml2.Response fromRequest = Atp.Saml2.Response.Create(Request);
// This returns true
if (!fromRequest.Validate(cert))
    throw new ApplicationException("The SAML response signature failed to verify with public certificate");
 
Atp.Saml2.Response fromXml = new Atp.Saml2.Response(fromRequest.GetXml());
// This returns false
if (!fromXml.Validate(cert))
    throw new ApplicationException("The SAML response signature failed to verify with public certificate");
 
Atp.Saml2.Response fromString = new Atp.Saml2.Response(fromRequest.ToBase64String());
// This returns false
if (!fromString.Validate(cert))
    throw new ApplicationException("The SAML response signature failed to verify with public certificate");
[/code]

Should this work?  Seems there might be a bug in the Response constructors.

Any thoughts/guidance are much apprciated.

Thanks!

---------------------------------------------------------------------- Note: This question has been asked on the Q&A forum of Thang Dang's fraudulent ComponentPro brand If you purchased anything from ComponentPro, you have been scammed. Contact the payment processor who sold you the license and ask for your money back. Back to ComponentPro Q&A Forum Index