IdentityServer4 with SustainSys.SAML is losing the original client redirect after ExternalLoginCallback.
I'm using the IdentityServer4 example application as a guide from the SustainSys.SAML netstandard branch here.
The only issue I'm having is that when I Log in at https://stubidp.sustainsys.com and it redirects back to my IdentityServer4 ExternalLoginCallback() method, I've lost my original client redirect (which was part of the original authorize redirect url. When this code returns:
var result = await HttpContext.AuthenticateAsync(IdentityServerConstants.ExternalCookieAuthenticationScheme);
The returnUrl and values in Properties.Items are the same and my original redirectUrl to get back to my client app (an Angular app), through the IdentityServer /authorize endpoint is gone.
I've tried the sample app it's behaving the same way.
Turns out I was setting the AuthenticationScheme for my ExternalProvider to the incorrect value. In my BuildLoginViewModelAsync() method called during the IdP login process was using the incorrect value here:
return new LoginViewModel
{
EnableLocalLogin = false,
ReturnUrl = returnUrl,
Username = context.LoginHint,
ExternalProviders = new[] { new ExternalProvider { AuthenticationScheme = **context.IdP** } }
};