Exemplo n.º 1
0
        public async Task <TwoFactorFido2ResponseModel> GetFido2([FromBody] TwoFactorRequestModel model)
        {
            var user = await CheckAsync(model.MasterPasswordHash, true);

            var fido2Keys = await _userService.GetAllFido2KeysAsync(user);

            var response = new TwoFactorFido2ResponseModel(user, fido2Keys);

            return(response);
        }
Exemplo n.º 2
0
        public async Task <TwoFactorFido2ResponseModel> PostFido2Registration([FromBody] TwoFactorFido2RegistrationRequestModel model)
        {
            var user = await CheckAsync(model.MasterPasswordHash, true);                                                          // Get user

            var success = await _userService.CompleteFido2RegistrationAsync(user, model.Name, model.AuthenticatorAttestationRaw); // Complete the registration by checking the signature and saving the public key

            var fido2Keys = await _userService.GetAllFido2KeysAsync(user);                                                        // Get all FIDO2 Keys of this user

            if (!success)
            {
                throw new BadRequestException("Unable to complete Fido2 key registration.");
            }
            var response = new TwoFactorFido2ResponseModel(user, fido2Keys); // Send the keys registed in the response

            return(response);
        }