Unmarshalling SAML assertion with openSAML2 (C++)

Cantor, Scott cantor.2 at osu.edu
Thu Dec 12 17:35:58 EST 2013


On 12/12/13, 5:20 PM, "Akshay Singh" <akshay_iiit at yahoo.com> wrote:

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

That's the only real source of simple examples.

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

At a quick glance, your code is doing a couple of things wrong:

- don't initialize Xerces, the library does that
- you aren't initializing OpenSAML, just XMLTooling

The object registrations are not happening for the SAML object types, so
you're getting back a generic object of whatever the default type is,
usually UnknownXMLObject.

OpenSAML will initialize XMLTooling in most cases, so calling its
configuration methods is usually sufficient.

-- Scott




More information about the dev mailing list