public ActionResult Logout()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            FormsAuthentication.SignOut();
            fam.SignOut(true);
            return(new RedirectResult(string.Format("https://accounts.accesscontrol.windows.net/v2/wsfederation?wa=wsignout1.0&wreply={0}", Url.Encode("http://localhost/OrgIdFederationSample"))));
        }
Пример #2
0
        public ActionResult LogOff()
        {
            WSFederationAuthenticationModule authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            //clear local cookie
            authModule.SignOut(false);

            //initiate federated sign out request to the STS
            SignOutRequestMessage signOutRequestMessage = new SignOutRequestMessage(new Uri(authModule.Issuer), authModule.Realm);
            String queryString = signOutRequestMessage.WriteQueryString();

            return(new RedirectResult(queryString));
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            try
            {
                FormsAuthentication.SignOut();
            }
            finally
            {
                fam.SignOut(true);
            }
        }
Пример #4
0
        private void SessionAuthenticationModule_SessionSecurityTokenReceived(object sender, SessionSecurityTokenReceivedEventArgs e)
        {
            if (e.SessionToken.ValidTo < DateTime.UtcNow)
            {
                // Remove the application cookies, etc.
                WSFederationAuthenticationModule WsFam = FederatedAuthentication.WSFederationAuthenticationModule;
                WsFam.SignOut(false);

                // Uncomment the following to end the session with AAD on inactivity timeout.  But this will cause a single sign out across all apps.
                //SignOutRequestMessage signOutRequestMessage = new SignOutRequestMessage(new Uri(WsFam.Issuer), WsFam.Reply + "Account/Logout");
                //String signOutRequest = signOutRequestMessage.WriteQueryString() + "&wtrealm=" + WsFam.Realm;
                //Response.Redirect(signOutRequest);
            }
        }
Пример #5
0
        public ActionResult Logout(string returnUrl)
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            try
            {
                HttpContext.AzureLogout();
            }
            finally
            {
                fam.SignOut(true);
            }

            return(Redirect(returnUrl));
        }
Пример #6
0
        public ActionResult Logout()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            try
            {
                FormsAuthentication.SignOut();
            }
            finally
            {
                fam.SignOut(true);
            }

            return(Redirect("/cz.html"));
        }
        public ActionResult Logout()
        {
            if (Request.IsAuthenticated)
            {
                // Remove the application cookies, etc.
                WSFederationAuthenticationModule WsFam = FederatedAuthentication.WSFederationAuthenticationModule;
                WsFam.SignOut(false);

                // Issue a sign out request to remove the STS session, etc.  This will cause an SSOut.
                SignOutRequestMessage signOutRequestMessage = new SignOutRequestMessage(new Uri(WsFam.Issuer), WsFam.Reply);
                String signOutRequest = signOutRequestMessage.WriteQueryString() + "&wtrealm=" + WsFam.Realm;
                return(new RedirectResult(signOutRequest));
            }

            return(new RedirectResult("/"));
        }
        public ActionResult SignOut()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            try
            {
                FormsAuthentication.SignOut();
            }
            finally
            {
                fam.SignOut(true);
            }

            // Return to home after LogOff
            return(RedirectToAction("Index", "Home"));
        }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User.Identity.IsAuthenticated)
            {
                // Remove the application cookies, etc.
                WSFederationAuthenticationModule WsFam = FederatedAuthentication.WSFederationAuthenticationModule;
                WsFam.SignOut(false);

                // Issue a sign out request to remove the STS session, etc.  This will trigger an SSOut.
                SignOutRequestMessage signOutRequestMessage = new SignOutRequestMessage(new Uri(WsFam.Issuer), WsFam.Reply);
                String signOutRequest = signOutRequestMessage.WriteQueryString() + "&wtrealm=" + WsFam.Realm;
                Response.Redirect(signOutRequest);
                return;
            }

            Response.Redirect("/");
        }
Пример #10
0
        public ActionResult SignOut()
        {
            WSFederationAuthenticationModule fam = FederatedAuthentication.WSFederationAuthenticationModule;

            try
            {
                FormsAuthentication.SignOut();
            }
            finally
            {
                FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie();
                fam.SignOut(true);
            }

            // Return to home after LogOff
            //SignOutRequestMessage signOutRequest = new SignOutRequestMessage(new Uri(fam.Issuer), fam.Realm);
            //return Redirect(signOutRequest.WriteQueryString());
            return(RedirectToAction("Index", "Home"));
        }
Пример #11
0
 /// <summary>
 /// Signs the user out using the Federation Authentication Module (FAM).
 /// </summary>
 /// <remarks>
 /// Federation Authentication Module SignOut calls Session Authentication Module (SAM) DeleteSessionTokenCookie.
 /// </remarks>
 public void SignOff()
 {
     Logger.Debug(
         "Initiating: SignOff.  Calling the SignOff method of the WSFederationAuthenticationModule. DateTime Utc: " + DateTime.UtcNow);
     _federationAuthenticationModule.SignOut(false);
 }