SP Initiated SSO + use extentions to pass attributes

We are current SAML2 (ASP.NET, version 3.3.0.0).

Is there is way to use extensions, or add additional parameters, to the AuthnRequest.

I tried the observers, but it gives and error no suitable method to override.

This functionality isn’t available in v3.3.0 which is five years old. You would need to upgrade to a more recent version.

The following code demonstrates adding extensions.

var xmlDocument = new XmlDocument();

xmlDocument.LoadXml("<demo xmlns=\"urn:demonstration\">This is a demonstration.</demo>");

var ssoOptions = new SSOOptions()
{
    Extensions = xmlDocument.ChildNodes
};

SAMLServiceProvider.InitiateSSO(Response, returnUrl, partnerIdP, ssoOptions);

The resultant XML is:

<samlp:AuthnRequest ID="_08c176f5-3808-4c78-967b-d4b070064615" Version="2.0">
  <saml:Issuer xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion">https://ExampleServiceProvider</saml:Issuer>
  <samlp:Extensions>
    <demo xmlns="urn:demonstration">This is a demonstration.</demo>
  </samlp:Extensions>
  <samlp:NameIDPolicy Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified" AllowCreate="true" />
</samlp:AuthnRequest>