Esempio n. 1
0
        public async Task <IActionResult> OnGetAsync(bool rememberMe, string returnUrl = null)
        {
            ReturnUrl  = returnUrl ?? "/";
            RememberMe = rememberMe;

            // Ensure the user has gone through the username & password screen first
            var user = await _signInManager.GetTwoFactorAuthenticationUserAsync();

            if (user is null)
            {
                throw new InvalidOperationException($"Unable to load two-factor authentication user.");
            }

            /*
             * var credentials = (await _store.GetCredentialIdsForUser(user.Email)).ToList();
             * if (!credentials.Any())
             *  throw new PublicKeyCredentialException("No keys registered for user");
             */

            // Creates the required fields for the `publicKeyCredentialRequestOptions` which are:
            // Base64Challenge, RelyingPartyId, UserId & Base64KeyIds if any
            AuthChallenge = (await _fido.InitiateAuthentication(user.Email)).ToBase64Dto(); // model.UserId

            return(Page());
        }
Esempio n. 2
0
        public async Task <IActionResult> OnGetAsync(bool rememberMe, string returnUrl = null)
        {
            ReturnUrl  = returnUrl ?? "/";
            RememberMe = rememberMe;

            // Creates the required fields for the `publicKeyCredentialRequestOptions` which are:
            // Base64Challenge, RelyingPartyId, UserId & Base64KeyIds if any
            AuthChallenge = (await _fido.InitiateAuthentication(null)).ToBase64Dto(); // since the user credential is stored in the key

            return(Page());
        }