Unmarshalling SAML assertion with openSAML2 (C++)

Akshay Singh akshay_iiit at yahoo.com
Fri Dec 13 12:09:15 EST 2013


Hi Scott,

Thanks for the help, it worked like a charm after I followed your suggestions.

For archiving purpose, the correct way is to initialize the openSAML library and terminate it at the end of the program.
Initialization of openSAML initializes xerces-c library and xmltooling (by default; you can specify to not to initialize it).

SAMLConfig::getConfig().init();/* initializes openSAML library, returns boolean */
SAMLConfig::getConfig().term();/* terminates openSAML library, returns nothing */


Best,
Akshay



On Thursday, 12 December 2013 7:41 PM, "Cantor, Scott" <cantor.2 at osu.edu> wrote:
 
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



--
To unsubscribe from this list send an email to dev-unsubscribe at shibboleth.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://shibboleth.net/pipermail/dev/attachments/20131214/40255d53/attachment.html 


More information about the dev mailing list