saml-2.0component-space

ComponentSpace SAML - Augment AuthnRequest XML before sign & send


I'm evaluating a SAML library from ComponentSpace vs. hand-rolling. I've read the docs from cover-to-cover.

Up to now its proved to save more time than manually writing requests, but my IDP makes use of samlp:Extensions and an additional attribute on the samlp:Issuer element.

It'd be convenient if there was a way to access and augment the generated XML document just prior to signing and 'sending'.

Our IDP also uses this lib (apparently) and since they use all these extra XML nodes, I assume there's a way. Just can't see it.

Thanks, Luke


Solution

  • In case it helps anyone, this is how to add the extensions:

    AuthnRequest authnRequest = new AuthnRequest();
    var doc = new XmlDocument();
    doc.LoadXml("<myCustomField>123</myCustomField>");
    authnRequest.Extensions = new Extensions();
    authnRequest.Extensions.Data = doc.ChildNodes;