However, if the SPID query string value does change or it’s not known beforehand, you can specify the SSO service URL using the following SAMLServiceprovider.InitiateSSO overload.
/// <summary>
/// Initiates single sign-on from the service provider to the identity provider (ie. SP-initiated SSO).
/// <para>
/// An authn request is sent to the identity provider.
/// </para>
/// </summary>
/// <param name="httpResponse">The HTTP response.</param>
/// <param name="relayState">The relay state or <c>null</c> if none.</param>
/// <param name="partnerIdP">The partner identity provider name or <c>null</c>.</param>
/// <param name="ssoOptions">The SSO options or <c>null</c>.</param>
/// <param name="assertionConsumerServiceUrl">The assertion consumer service URL or <c>null</c> if the configured URL is to be used.</param>
/// <param name="singleSignOnServiceUrl">The single sign-on service URL or <c>null</c> if the configured URL is to be used.</param>
/// <exception cref="SAMLException">
/// Thrown when the single sign-on fails.
/// </exception>
public static void InitiateSSO(HttpResponse httpResponse, string relayState, string partnerIdP, SSOOptions ssoOptions, string assertionConsumerServiceUrl, string singleSignOnServiceUrl)
If the singleSignOnServiceUrl parameter is specified, this is used instead of the configured URL.
Hi,
While waiting for the client to continue this development, I made some tests using your ExampleIdentityProvider.
I made changes to my code
if (!string.IsNullOrEmpty(config.AdditionalInitialAuthnReqRedirectParams))
{
// Ottiene l'URL del servizio Single Sign-On dell'Identity Provider
var SSOServiceUrl = SAMLController.Configuration.PartnerIdentityProviderConfigurations[0]?.SingleSignOnServiceUrl;
// Avvia il Single Sign-On includendo i parametri aggiuntivi nella richiesta
SAMLServiceProvider.InitiateSSO(
Response,
returnUrl,
partnerIdP,
null,
null,
SSOServiceUrl + "?" + config.AdditionalInitialAuthnReqRedirectParams
);
}
else
{
// Avvia il Single Sign-On senza parametri aggiuntivi
SAMLServiceProvider.InitiateSSO(Response, returnUrl, partnerIdP);
}
I retrieve the SSOServiceUrl from the only IdP I have for testing and I concatenate the value SPID, like this: