示例#1
0
        public async Task <IActionResult> BackToApp()
        {
            if (User.Identity.IsAuthenticated)
            {
                string accessToken = await HttpContext.GetTokenAsync("access_token");

                OktaHelper oktaHelper = new OktaHelper(_Config);
                var        response   = await oktaHelper.RevokeToken(accessToken);

                foreach (var cookie in Request.Cookies.Keys)
                {
                    Response.Cookies.Delete(cookie);
                }
            }

            string appUrl = dp.UnprotectStr(Request.Query["key"].ToString());

            if (!Uri.IsWellFormedUriString(appUrl, UriKind.Absolute))
            {
                TempData["Message"] = "Sorry something went wrong, please try again!"; //"No valid Url detected to redirect, please initiate the request from the application.";
                return(View("~/Views/Error.cshtml"));
            }
            else
            {
                return(Redirect(appUrl));
            }
        }
示例#2
0
        public async Task <IActionResult> ChangePasswordMessage()
        {
            if (User.Identity.IsAuthenticated)
            {
                string accessToken = await HttpContext.GetTokenAsync("access_token");

                OktaHelper oktaHelper = new OktaHelper(_Config);
                var        response   = await oktaHelper.RevokeToken(accessToken);

                foreach (var cookie in Request.Cookies.Keys)
                {
                    Response.Cookies.Delete(cookie);
                }
            }

            if (Request.Query["status"].ToString().ToUpper() == "SUCCESS")
            {
                ViewData["Message"] = "Password is changed successfully. Please click the below link to go back to the application";
            }

            ViewBag.Key = Request.Query["key"];
            return(View($"~/Views/Profile/ChangePasswordMessage.cshtml"));
        }