public ActionResult Index()
        {
            var config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            var callbackUrl = Url.Action("Callback", "Logout", null, Request.Url.Scheme);
            var signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
            signoutMessage.SetParameter("wtrealm", config.Realm);
            FederatedAuthentication.SessionAuthenticationModule.SignOut();

            return new RedirectResult(signoutMessage.WriteQueryString());
        }
        public ActionResult SignOut()
        {
            WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            // Redirect to SignOutCallback after signing out.
            string callbackUrl = Url.Action("SignOutCallback", "Account", routeValues: null, protocol: Request.Url.Scheme);
            SignOutRequestMessage signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
            signoutMessage.SetParameter("wtrealm", IdentityConfig.Realm ?? config.Realm);
            FederatedAuthentication.SessionAuthenticationModule.SignOut();

            return new RedirectResult(signoutMessage.WriteQueryString());
        }
Exemplo n.º 3
0
        public ActionResult Index()
        {
            var config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            var callbackUrl    = Url.Action("Callback", "Logout", null, Request.Url.Scheme);
            var signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);

            signoutMessage.SetParameter("wtrealm", config.Realm);
            FederatedAuthentication.SessionAuthenticationModule.SignOut();

            return(new RedirectResult(signoutMessage.WriteQueryString()));
        }
Exemplo n.º 4
0
        public ActionResult SignOut()
        {
            WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            // Redirect to home page after signing out.
            string callbackUrl = Url.Action("Index", "Home", routeValues: null, protocol: Request.Url.Scheme);
            SignOutRequestMessage signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
            signoutMessage.SetParameter("wtrealm", IdentityConfig.Realm ?? config.Realm);
            FederatedAuthentication.SessionAuthenticationModule.SignOut();

            return new RedirectResult(signoutMessage.WriteQueryString());
        }
        public ActionResult SignOut()
        {
            var config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            string callbackUrl = Url.Action("Index", "Home", routeValues: null, protocol: Request.Url.Scheme);
            var signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer),callbackUrl);
            signoutMessage.SetParameter("wtrealm",config.Realm);

            FederatedAuthentication.WSFederationAuthenticationModule.SignOut();

            return new RedirectResult(signoutMessage.WriteQueryString());
        }
Exemplo n.º 6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (Request.IsAuthenticated)
     {
         WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;
         string callbackUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Response.ApplyAppPathModifier("~/");
         SignOutRequestMessage signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
         signoutMessage.SetParameter("wtrealm", IdentityConfig.Realm ?? config.Realm);
         FederatedAuthentication.SessionAuthenticationModule.SignOut();
         Response.Redirect(signoutMessage.WriteQueryString());
     }
 }
Exemplo n.º 7
0
        //
        // GET: /Admin/SignOut

        public void SignOut()
        {
            WsFederationConfiguration fc = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            string wreply = System.Web.HttpContext.Current.Request.UrlReferrer.ToString();

            SignOutRequestMessage soMessage = new SignOutRequestMessage(new Uri(fc.Issuer), wreply);

            soMessage.SetParameter("wtrealm", fc.Realm);

            FederatedAuthentication.SessionAuthenticationModule.SignOut();
            Response.Redirect(soMessage.WriteQueryString());
        }
Exemplo n.º 8
0
        public ActionResult LogOff()
        {
            WsFederationConfiguration fc =
            FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

            string request = System.Web.HttpContext.Current.Request.Url.ToString();
            string wreply = request.Substring(0, request.Length - 7);
            SignOutRequestMessage soMessage =
                            new SignOutRequestMessage(new Uri(fc.Issuer), wreply);
            soMessage.SetParameter("wtrealm", fc.Realm);
            FederatedAuthentication.SessionAuthenticationModule.SignOut();
            Response.Redirect(soMessage.WriteQueryString());
            return RedirectToAction("Index", "Home");
        }
Exemplo n.º 9
0
 public ActionResult Logoff()
 {
     WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;
     string callbackUrl = Request.Url.GetLeftPart(UriPartial.Authority) + Response.ApplyAppPathModifier("~/");
     SignOutRequestMessage signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
     signoutMessage.SetParameter("wtrealm", IdentityConfig.Realm ?? config.Realm);
     FederatedAuthentication.SessionAuthenticationModule.SignOut();
     Response.Redirect(signoutMessage.WriteQueryString());
     return null;
 }
        public ActionResult LogOff()
        {
            if (this.AuthenticationManager.User.Identity.AuthenticationType == "Federation")
            {
                WsFederationConfiguration config = FederatedAuthentication.FederationConfiguration.WsFederationConfiguration;

                // Redirect to home page after signing out.
                string callbackUrl = Url.Action("Index", "Home", routeValues: null, protocol: Request.Url.Scheme);
                SignOutRequestMessage signoutMessage = new SignOutRequestMessage(new Uri(config.Issuer), callbackUrl);
                signoutMessage.SetParameter("wtrealm", IdentityConfig.Realm ?? config.Realm);
                FederatedAuthentication.SessionAuthenticationModule.SignOut();

                return new RedirectResult(signoutMessage.WriteQueryString());
            }
            else 
            {
                this.AuthenticationManager.SignOut();
                return this.RedirectToAction("Index", "Home");
            }
        }