コード例 #1
0
        public async Task <ActionResult> SelectRecoveryAuthenticatorAsync(SelectRecoveryAuthenticatorViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View("SelectRecoveryAuthenticator", model));
            }

            try
            {
                var applyAuthenticatorResponse = await _idxClient.SelectRecoveryAuthenticatorAsync(
                    new SelectAuthenticatorOptions { AuthenticatorId = model.AuthenticatorId },
                    (IIdxContext)Session["IdxContext"]);

                Session["IdxContext"]         = applyAuthenticatorResponse.IdxContext;
                Session["isPasswordSelected"] = false;

                if (applyAuthenticatorResponse.AuthenticationStatus == AuthenticationStatus.AwaitingAuthenticatorVerification)
                {
                    return(RedirectToAction("VerifyAuthenticator", "Manage"));
                }

                return(View("SelectRecoveryAuthenticator", model));
            }
            catch (OktaException exception)
            {
                ModelState.AddModelError(string.Empty, exception.Message);
                return(View("SelectRecoveryAuthenticator", model));
            }
        }
コード例 #2
0
        public ActionResult SelectRecoveryAuthenticator()
        {
            var viewModel = new SelectRecoveryAuthenticatorViewModel
            {
                Authenticators = (List <AuthenticatorViewModel>)Session["authenticators"],
            };

            return(View(viewModel));
        }