title: Identityserver4 with ComponentSpace SAML 2 get custom parameters during request
body: <p>I am using IdentityServer4 with two external Idp's, one with WSFederation (ADFS) and one with SAML.</p>
  
  <p>For the SAML implementation I use the commercial product ComponentSpace SAML 2 for ASP.Net Core. I use the middleware-based config.</p>
  
  <p>Logging it with both Idp's works perfectly, but now I have the situation where, depending on the client, I need to pass extra parameters to the SAML AuthnRequest. I know how to pass this extra parameter in the request (I can use the OnAuthnRequestCreated from the middleware), but what I don't know is how to test at that point from where the request is coming, i.e. from which client.</p>
  
  <p>I have control of the client so I could also pass extra acr_values (which I think can be used to pass custom data), but again I don't know how to get them in the OnAuthnRequestCreated event as shown in the code below.</p>
  
  <p>Any help would be much appreciated.</p>
  
  <pre><code>services.AddSaml(Configuration.GetSection("SAML"));
  
  services.AddAuthentication()
              .AddWsFederation("adfs", options =&gt;
              {
                  options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                  //...rest of config (SSO is working)
              })
              .AddSaml("saml", options =&gt;
              {
                  options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                  //...rest of config (SSO is working)
  
                  options.OnAuthnRequestCreated = request =&gt;
                  {                      
                      //Here I would need to know from which client the request is coming (either by client name or url or acr_values or whatever)
                      //to be able to perform conditional logic. I've checked on the request object itself but the info is not in there
  
                      return request;
                  };
              });
  </code></pre>