Unmarshalling SAML assertion with openSAML 2 (C++)
Paul Hethmon
paul.hethmon at clareitysecurity.com
Thu Dec 12 15:24:39 EST 2013
Please post to the DEV list for programming questions.
Paul
From: Akshay Singh <akshay_iiit at yahoo.com<mailto:akshay_iiit at yahoo.com>>
Reply-To: Shibboleth Users <users at shibboleth.net<mailto:users at shibboleth.net>>
Date: Thursday, December 12, 2013 3:14 PM
To: Shibboleth Users <users at shibboleth.net<mailto:users at shibboleth.net>>
Subject: Unmarshalling SAML assertion with openSAML 2 (C++)
HI List,
I need to unmarshall a SAML assertion which I get from a web-service.
Since there is not much documentation on the internet for the C++ version of openSAML, I looked in to the samltest (in source code) to find out how to unmarshall/parse a SAML response. Everything seems to work fine, until I try to typecast the retrieved XMLObject to opensaml::saml2::Assertion :
/* Converting XMLObject to SAML2::Asserion */
opensaml::saml2::Assertion* assertion = dynamic_cast<opensaml::saml2::Assertion*>(xo);
this returns NULL (showing XMLObject I retrieved cannot be casted to saml::saml2::Assertion).
I understand I am trying to downcast an object pointer, which is not guaranteed to work. But then this is the way it is being done in samltest tests (samltest/saml2/core/impl/Assertion20Test.h). Am I missing something?
I have checked the retrieved XMLObject object and it seems to function well.
For reference, the class hierarchy is something like this :
xmlTooling::XMLObject -> saml::signature::SignableObject -> saml::RootObject ->saml::saml2::RootObject -> saml::saml2::Assertion
xmlTooling::XMLObject -> saml::signature::SignableObject -> saml::RootObject ->saml::Assertion -> saml::saml2::Assertion
Posting my sample code on pastebin :
1) http://snipt.org/Bzjb5 - CPP program trying to unmarshal SAML assertion
2) http://snipt.org/Bzjc9 - Retrieved SAML assertion (this surely is well-formed, but in case.. )
Thanks,
Akshay
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/users/attachments/20131212/a634a34d/attachment.html
More information about the users
mailing list