Hello, I am trying to perform an SLO for an SP site with TWO IdP’s. Right now, the person gets logged out but when they click log in on the SP site it just logs them in. My understanding is they should be required to log back in on the IdP first. So clearly something is not working.
C# Code for activating SLO:
public ActionResult LogOff()
{
try
{
var user = userManager.FindByName(User.Identity.Name);
if (!string.IsNullOrWhiteSpace(user.ExternalId))
{
Log.Info("Logging out for user {user} with external id {external}", user.UserName, user.ExternalId);
if (SAMLServiceProvider.CanSLO())
{
Log.Info("I can SLO.");
// Request logout at the identity provider.
SAMLServiceProvider.InitiateSLO(Response, $"User {user.UserName} logging out.", null);
Log.Info("SLO Complete");
//return new EmptyResult();
}
}
Session.Clear();
Session.Abandon();
Response.Cookies["CartToken"].Value = string.Empty;
Response.Cookies["CartToken"].Expires = DateTime.Now.AddDays(-1);
AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
return RedirectToAction("Index", "Home");
}
catch (Exception ex)
{
Log.Error(ex, "Error trying to log out.");
return RedirectToAction("Index", "Home").WithError("Problem logging out. Please contact support.");
}
}
SAML config:
<?xml version="1.0"?>
<SAMLConfiguration xmlns="urn:componentspace:SAML:2.0:configuration">
<ServiceProvider Name="MIR_DeereTBS_SP_UAT"
AssertionConsumerServiceUrl="~/SAML/AssertionConsumerService" />
<PartnerIdentityProviders>
<PartnerIdentityProvider Name="http://www.okta.com/foo"
PartnerCertificateFile="Certificates\Contoso_IdP.demo.cer"
SingleSignOnServiceUrl="SSO URL"
SingleLogoutServiceUrl="SLO URLl" />
<PartnerIdentityProvider Name="http://www.okta.com/bar"
PartnerCertificateFile="Certificates\contoso_idp.internal.demo.cer"
SingleSignOnServiceUrl="SSO URL"
SingleLogoutServiceUrl="SLO URL" />
</PartnerIdentityProviders>
</SAMLConfiguration>