Esempio n. 1
0
 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();
     }
 }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
        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);
            }
        }
Esempio n. 5
0
        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();
            }
        }
Esempio n. 6
0
 private async Task LoadStoredCredentialsAsync()
 {
     StoredCredentials = await FidoService.GetCredentialsByUserEmail(CurrentUser.Email);
 }