public ActionResult Logout()
{
IdentitySource identitySource = null;
// If there's an "authenticated-by" claim in the token, we can use that to identify the identity source
UserIdentity identity = Thread.CurrentPrincipal.AsUserIdentity();
if (!String.IsNullOrEmpty(identity.IdentifiedBy)) {
identitySource = GetIdentitySource(identity.IdentifiedBy);
}
// Remove the session token
SessionIdentityManager.ClearSessionPrincipal();
// If we found an identity source, give it a chance to log out
if(identitySource != null) {
identitySource.Logout(ControllerContext);
}
return RedirectToAction("View", "Page", new {page = (Page)null});
}