Beispiel #1
0
        public void SignOut()
        {
            string callbackUrl = Url.Action("SignOutCallback", "Account", routeValues: null, protocol: Request.Url.Scheme);

            FederatedAuthentication.WSFederationAuthenticationModule.SignOut(callbackUrl);
            WSFederationAuthenticationModule.FederatedSignOut(new Uri(FederatedAuthentication.WSFederationAuthenticationModule.Issuer), new Uri(callbackUrl));
        }
        // GET: api/Logout/
        public string Get()
        {
            //Session.Abandon();
            //FormsAuthentication.SignOut();

            //string absoluteUrl = HttpContext.Request.Url.AbsoluteUri;
            //string replyUrl = absoluteUrl.Substring(0, absoluteUrl.LastIndexOf("/") + 1);
            var issuer  = ConfigurationManager.AppSettings["AuthUrl"];
            var replyTo = ConfigurationManager.AppSettings["ActionUrl"];

            //WSFederationAuthenticationModule.FederatedSignOut(new Uri(), new Uri());

            try
            {
                FormsAuthentication.SignOut();
                Session.Abandon();
                WSFederationAuthenticationModule.FederatedSignOut(new Uri(issuer), new Uri(replyTo));
            }

            finally
            {
                FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie();
            }

            return("success");
        }
Beispiel #3
0
        public void Process(LogoutArgs args)
        {
            Assert.ArgumentNotNull(args, "args");

            var authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            WSFederationAuthenticationModule.FederatedSignOut(new Uri(authModule.Issuer), new Uri("https://uclasandbox.dustland.com"));
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        string absoluteUri  = HttpContext.Current.Request.Url.AbsoluteUri;
        string loginPageUri = absoluteUri.Substring(0, absoluteUri.LastIndexOf("/") + 1)
                              + "Login.aspx";

        WSFederationAuthenticationModule.FederatedSignOut
            (null, new Uri("https://localhost:497/index.aspx"));
    }
        public ActionResult Logout()
        {
            // Load Identity Configuration
            FederationConfiguration config = FederatedAuthentication.FederationConfiguration;

            // Sign out of WIF.
            WSFederationAuthenticationModule.FederatedSignOut(new Uri(ConfigurationManager.AppSettings["ida:Issuer"]), new Uri(config.WsFederationConfiguration.Realm));

            return(View());
        }
Beispiel #6
0
        public void SignOut()
        {
            string callbackUrl = Url.Action("SignOutCallback", "Account", routeValues: null, protocol: Request.Url.Scheme);

            // Alternativ logud kun lokalt
            //FederatedAuthentication.SessionAuthenticationModule.SignOut();
            //FederatedAuthentication.SessionAuthenticationModule.DeleteSessionTokenCookie();

            WSFederationAuthenticationModule authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            WSFederationAuthenticationModule.FederatedSignOut(new Uri(authModule.Issuer), new Uri(callbackUrl));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }

            Log.Info(Sitecore.Context.User.Name + " logged out from federated SSO.", this);
            var authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            WSFederationAuthenticationModule.FederatedSignOut(new Uri(authModule.Issuer), new Uri(Request.Url.Scheme + "://" + Request.Url.Host));
        }
Beispiel #8
0
        public ActionResult Logout()
        {
            //// Load Identity Configuration
            //FederationConfiguration config = FederatedAuthentication.FederationConfiguration;

            // FederatedAuthentication.ServiceConfiguration.

            var uri = new Uri("http://localhost:26758/");

            //// Sign out of WIF.
            WSFederationAuthenticationModule.FederatedSignOut(new Uri(ConfigurationManager.AppSettings["ida:Issuer"]), uri);

            return(View());
        }
Beispiel #9
0
        /// <summary>
        /// Handles the PreRender event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_PreRender(object sender, EventArgs e)
        {
            // Initiate a federated sign out to the Issuing Party (IP). After the Issuing Party (IP) completes its sign out action, it will issue a request which will be
            // unauthenticated, to navigate back to this Relying Party (RP) application. The unauthenticated request will force a Secure Token Request (STR) which will then
            // force navigation to the Issuing Party (IP) hosted login page in order to provide credentials.

            // TODO: Figure out how to notify the right Identity Provider about the sign out.
            // The code below notifies the configuration defined "issuer" of the signout. The issuer defined in configuration is not necessarily the actual issuer.
            // This can be the case when multiple issuers exist.
            logger.Debug("Initiating: SignOff. Calling the FederatedSignOut method of the WSFederationAuthenticationModule DateTime Utc: " + DateTime.UtcNow);
            var authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            WSFederationAuthenticationModule.FederatedSignOut(new Uri(authModule.Issuer), new Uri(authModule.Realm));
        }
Beispiel #10
0
        public ActionResult LogOut()
        {
            if (!this.User.Identity.IsAuthenticated)
            {
                return(new EmptyResult());
            }
            var authModule = FederatedAuthentication.WSFederationAuthenticationModule;

            authModule.SignOut();
            // string signoutUrl = (WSFederationAuthenticationModule.GetFederationPassiveSignOutUrl(authModule.Issuer, authModule.Realm, null));
            var baseUrl = VirtualPathUtility.AppendTrailingSlash(Request.Url.GetLeftPart(UriPartial.Authority) + Request.ApplicationPath);

            FederatedAuthentication.SessionAuthenticationModule.SignOut();
            WSFederationAuthenticationModule.FederatedSignOut(new Uri(authModule.Issuer), new Uri(baseUrl + "HPMS.aspx"));
            return(new EmptyResult());
        }
Beispiel #11
0
        public ActionResult SignOut()
        {
            AuthDataManager.CleanupCookies(Response);
            if (User == null || !User.Identity.IsAuthenticated)
            {
                return(View());
            }
            else
            {
                var stsUri  = FederatedAuthentication.WSFederationAuthenticationModule.Issuer;
                var backUrl = FederatedAuthentication.WSFederationAuthenticationModule.Realm;

                WSFederationAuthenticationModule.FederatedSignOut(new Uri(stsUri, UriKind.RelativeOrAbsolute), new Uri(backUrl, UriKind.RelativeOrAbsolute));
                return(new EmptyResult());
            }
        }
        public virtual ActionResult ChangeUser()
        {
            var federationModule = FederatedAuthentication.WSFederationAuthenticationModule;

            if (federationModule != null)
            {
                if (!string.IsNullOrEmpty(federationModule.Reply) &&
                    !string.IsNullOrEmpty(federationModule.Issuer))
                {
                    var replyUrl = new Uri(FederatedAuthentication.WSFederationAuthenticationModule.Reply);
                    var issuer   = new Uri(FederatedAuthentication.WSFederationAuthenticationModule.Issuer);
                    WSFederationAuthenticationModule.FederatedSignOut(issuer, replyUrl);
                }
            }

            return(View());
        }
Beispiel #13
0
        //will delete session and call the identity provider
        public ActionResult Logout()
        {
            //delete authentication session
            Session[Const.CLAIM.USER_ACCESS_LEVEL] = null;
            Session[Const.CLAIM.USER_ACCOUNT]      = null;
            Session[Const.CLAIM.USER_ID]           = null;
            Session[Const.CLAIM.USER_FIRST_NAME]   = null;
            Session[Const.CLAIM.USER_LAST_NAME]    = null;

            // Load Identity Configuration
            FederationConfiguration config = FederatedAuthentication.FederationConfiguration;

            // Sign out of WIF.
            WSFederationAuthenticationModule.FederatedSignOut(new Uri(ConfigurationManager.AppSettings["ida:Issuer"]), new Uri(config.WsFederationConfiguration.Realm));

            return(View());
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (User != null && User.Identity != null && User.Identity.IsAuthenticated)
            {
                var ub = new UriBuilder(this.Request.Url);
                ub.Path     = "/";
                ub.Query    = "";
                ub.Fragment = "";
                var issuerSignoutUrl =
                    new UriBuilder(new Uri(FederatedAuthentication.FederationConfiguration.WsFederationConfiguration.Issuer, UriKind.Absolute));
                if (Request.Url.Host == "www.grean.id")
                {
                    issuerSignoutUrl.Host = "easyid.www.grean.id";
                }

                WSFederationAuthenticationModule.FederatedSignOut(
                    issuerSignoutUrl.Uri, ub.Uri);
            }
            else
            {
                Response.Redirect("/");
            }
        }
Beispiel #15
0
        private void DoFederatedSignOut()
        {
            string providerName = GetProviderNameFromCookie();
            SPTrustedLoginProvider loginProvider = null;

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                loginProvider = GetLoginProvider(providerName);
            });

            if (loginProvider != null)
            {
                string returnUrl = string.Format(
                    System.Globalization.CultureInfo.InvariantCulture,
                    "{0}://{1}/_layouts/SignOut.aspx",
                    HttpContext.Current.Request.Url.Scheme,
                    HttpContext.Current.Request.Url.Host);
                HttpCookie signOutExpiredCookie = new HttpCookie(SignOutCookieName, string.Empty);
                signOutExpiredCookie.Expires = new DateTime(1970, 1, 1);
                HttpContext.Current.Response.Cookies.Remove(SignOutCookieName);
                HttpContext.Current.Response.Cookies.Add(signOutExpiredCookie);
                WSFederationAuthenticationModule.FederatedSignOut(loginProvider.ProviderUri, new Uri(returnUrl));
            }
        }