private async Task SaveSecurityKeyAsync() { try { await FidoService.UpdateSecurityKeyNameAsync(FidoStoredCredential.Id, SecurityKeyName); await ModalDialogClose(); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
private async Task UpdateSecurityKeyAsync() { try { await FidoService.UpdateSecurityKeyNameAsync(SecurityKeyId, SecurityKeyName); await ToastService.ShowToastAsync("Security key updated.", ToastType.Success); await ModalDialogClose(); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogCancel(); } }
protected override async Task OnInitializedAsync() { try { FidoService = ScopedServices.GetRequiredService <IFido2Service>(); var credential = await FidoService.GetCredentialsById(SecurityKeyId); SecurityKeyName = credential.SecurityKeyName; Initialized = true; } catch (Exception ex) { Logger.LogError(ex.Message); await ModalDialogService.CancelAsync(); } }
private async Task ConfigureSecurityKeyAsync() { try { ChangeState(SecurityKeyAddingStep.Configuration); FidoStoredCredential = await FidoService.AddSecurityKeyAsync(CurrentUser.Email, JSRuntime); await ToastService.ShowToastAsync("Security key added.", ToastType.Success); ChangeState(SecurityKeyAddingStep.Done); } catch (Exception ex) { Logger.LogError(ex.Message); ChangeState(SecurityKeyAddingStep.Error); } }
private async Task DeleteSecurityKeyAsync() { try { await FidoService.RemoveSecurityKeyAsync(SecurityKeyId); await ToastService.ShowToastAsync("Security key deleted.", ToastType.Success); await Refresh.InvokeAsync(); await ModalDialogService.CloseAsync(); } catch (Exception ex) { Logger.LogError(ex.Message); await ToastService.ShowToastAsync(ex.Message, ToastType.Error); await ModalDialogService.CloseAsync(); } }
private async Task LoadStoredCredentialsAsync() { StoredCredentials = await FidoService.GetCredentialsByUserEmail(CurrentUser.Email); }