Exemplo n.º 1
0
        public async Task <TwoFactorWebAuthnResponseModel> GetWebAuthn([FromBody] SecretVerificationRequestModel model)
        {
            var user = await CheckAsync(model, true);

            var response = new TwoFactorWebAuthnResponseModel(user);

            return(response);
        }
Exemplo n.º 2
0
        public async Task <TwoFactorWebAuthnResponseModel> GetWebAuthn([FromBody] TwoFactorRequestModel model)
        {
            var user = await CheckAsync(model.MasterPasswordHash, true);

            var response = new TwoFactorWebAuthnResponseModel(user);

            return(response);
        }
Exemplo n.º 3
0
        public async Task <TwoFactorWebAuthnResponseModel> DeleteWebAuthn([FromBody] TwoFactorWebAuthnDeleteRequestModel model)
        {
            var user = await CheckAsync(model, true);

            await _userService.DeleteWebAuthnKeyAsync(user, model.Id.Value);

            var response = new TwoFactorWebAuthnResponseModel(user);

            return(response);
        }
Exemplo n.º 4
0
        public async Task <TwoFactorWebAuthnResponseModel> PutWebAuthn([FromBody] TwoFactorWebAuthnRequestModel model)
        {
            var user = await CheckAsync(model, true);

            var success = await _userService.CompleteWebAuthRegistrationAsync(
                user, model.Id.Value, model.Name, model.DeviceResponse);

            if (!success)
            {
                throw new BadRequestException("Unable to complete WebAuthn registration.");
            }
            var response = new TwoFactorWebAuthnResponseModel(user);

            return(response);
        }