Exemplo n.º 1
0
        public ActionResult Logout()
        {
            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Request for SLO received.");

            // Logout locally.
            FormsAuthentication.SignOut();

            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: User was logged out locally.");

            if (SAMLServiceProvider.CanSLO())
            {
                // Request logout at the identity provider.
                string partnerIdP = Session["IdentityProvider"].ToString();

                SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Initiating SLO with IdP {partnerIdP}.");

                SAMLServiceProvider.InitiateSLO(Response, null, null, partnerIdP);

                return(new EmptyResult());
            }

            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Identity Provider doesn't support SLO.");

            return(RedirectToAction("Index", "Home"));
        }
        public ActionResult LogOff()
        {
            // Logout locally.
            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

            if (SAMLServiceProvider.CanSLO())
            {
                // Request logout at the identity provider.
                SAMLServiceProvider.InitiateSLO(Response, null, null);

                return(new EmptyResult());
            }

            return(RedirectToAction("Index", "Home"));
        }
Exemplo n.º 3
0
        protected void logoutButton_Click(object sender, EventArgs e)
        {
            FormsAuthentication.SignOut();

            if (SAMLServiceProvider.CanSLO(WebConfigurationManager.AppSettings[AppSettings.PartnerIdP]))
            {
                // Request logout at the identity provider.
                string partnerIdP = WebConfigurationManager.AppSettings[AppSettings.PartnerIdP];
                SAMLServiceProvider.InitiateSLO(Response, null, null, partnerIdP);
            }
            else
            {
                FormsAuthentication.RedirectToLoginPage();
            }
        }
Exemplo n.º 4
0
        public override object Logout(IServiceBase service, Authenticate request)
        {
            if (SAMLServiceProvider.CanSLO())
            {
                // Request logout at the identity provider.
                string partnerIdP = WebConfigurationManager.AppSettings[PartnerIdP];
                SAMLServiceProvider.InitiateSLO(HttpContext.Current.Response, null, null, partnerIdP);
            }



            base.Logout(service, request);

            (HttpContext.Current.ToResponse() as AspNetResponse).End();
            return(null);
        }
Exemplo n.º 5
0
        public ActionResult LogOff()
        {
            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Request for SLO received.");

            string partnerIdP = ((ClaimsIdentity)User.Identity).FindFirstValue(IdentityProviderClaimType);

            // Logout locally.
            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Log out user {User.Identity.Name} locally.");
            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

            if (SAMLServiceProvider.CanSLO(partnerIdP))
            {
                SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Initiating SLO with IdP {partnerIdP}.");

                // Request logout at the identity provider.
                SAMLServiceProvider.InitiateSLO(Response, null, null, partnerIdP);

                return(new EmptyResult());
            }

            SamlPocTraceListener.Log("SAML", $"SamlController.Logout: Identity Provider {partnerIdP} doesn't support SLO.");

            return(RedirectToAction("Index", "Home"));
        }