public UIAccountController( UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, SignInManager <ApplicationUser> signInManager, SettingsRepository settingsRepository, Configuration.BTCPayServerOptions options, BTCPayServerEnvironment btcPayServerEnvironment, EventAggregator eventAggregator, Fido2Service fido2Service, UserLoginCodeService userLoginCodeService, LnurlAuthService lnurlAuthService, LinkGenerator linkGenerator, Logs logs) { _userManager = userManager; _signInManager = signInManager; _RoleManager = roleManager; _SettingsRepository = settingsRepository; _Options = options; _btcPayServerEnvironment = btcPayServerEnvironment; _fido2Service = fido2Service; _lnurlAuthService = lnurlAuthService; _linkGenerator = linkGenerator; _userLoginCodeService = userLoginCodeService; _eventAggregator = eventAggregator; _logger = logs.PayServer; Logs = logs; }
public UIManageController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, EmailSenderFactory emailSenderFactory, ILogger <UIManageController> logger, UrlEncoder urlEncoder, StoreRepository storeRepository, BTCPayServerEnvironment btcPayServerEnvironment, APIKeyRepository apiKeyRepository, IAuthorizationService authorizationService, Fido2Service fido2Service, LinkGenerator linkGenerator, UserService userService, UserLoginCodeService userLoginCodeService ) { _userManager = userManager; _signInManager = signInManager; _EmailSenderFactory = emailSenderFactory; _logger = logger; _urlEncoder = urlEncoder; _btcPayServerEnvironment = btcPayServerEnvironment; _apiKeyRepository = apiKeyRepository; _authorizationService = authorizationService; _fido2Service = fido2Service; _linkGenerator = linkGenerator; _userLoginCodeService = userLoginCodeService; _userService = userService; _StoreRepository = storeRepository; }
private async Task NextAsync() { try { await ButtonSpinner.SpinAsync(async() => { var user = await ApplicationUserService.GetUserByEmailAsync(UserEmailModel.Email); if (user == null) { ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), HESException.GetMessage(HESCode.UserNotFound)); return; } PasswordSignInModel.Email = UserEmailModel.Email; HasSecurityKey = (await Fido2Service.GetCredentialsByUserEmail(UserEmailModel.Email)).Count > 0; AuthenticationStep = AuthenticationStep.EnterPassword; }); } catch (HESException ex) { ValidationErrorMessage.DisplayError(nameof(UserEmailModel.Email), ex.Message); } catch (Exception ex) { Logger.LogError(ex.Message); SetErrorMessage(ex.Message); } }
private async Task RegisterSecurityKeyAsync() { try { RegistrationStep = SecurityKeyRegistrationStep.Configuration; await Fido2Service.AddSecurityKeyAsync(User.Email, JSRuntime); RegistrationStep = SecurityKeyRegistrationStep.Done; } catch (Exception ex) { Logger.LogError(ex.Message); RegistrationStep = SecurityKeyRegistrationStep.Error; } }
protected override async Task OnInitializedAsync() { try { ApplicationUserService = ScopedServices.GetRequiredService <IApplicationUserService>(); Fido2Service = ScopedServices.GetRequiredService <IFido2Service>(); var code = NavigationManager.GetQueryValue("code"); var email = NavigationManager.GetQueryValue("email"); // Check user exist User = await ApplicationUserService.GetUserByEmailAsync(email); if (User == null) { RegistrationStep = SecurityKeyRegistrationStep.UserNotFound; } // Check key is already added var cred = await Fido2Service.GetCredentialsByUserEmail(User.Email); if (cred.Count > 0) { RegistrationStep = SecurityKeyRegistrationStep.AlreadyAdded; } // Verify token var tokenIsValid = await ApplicationUserService.VerifyRegisterSecurityKeyTokenAsync(User, code); if (!tokenIsValid) { RegistrationStep = SecurityKeyRegistrationStep.InvalidToken; } SetInitialized(); } catch (Exception ex) { Logger.LogError(ex.Message); SetLoadFailed(ex.Message); } }
public AccountController( UserManager <ApplicationUser> userManager, RoleManager <IdentityRole> roleManager, SignInManager <ApplicationUser> signInManager, SettingsRepository settingsRepository, Configuration.BTCPayServerOptions options, BTCPayServerEnvironment btcPayServerEnvironment, EventAggregator eventAggregator, Fido2Service fido2Service) { _userManager = userManager; _signInManager = signInManager; _RoleManager = roleManager; _SettingsRepository = settingsRepository; _Options = options; _btcPayServerEnvironment = btcPayServerEnvironment; _fido2Service = fido2Service; _eventAggregator = eventAggregator; _logger = Logs.PayServer; }
public AccountManageController( UserManager <ApplicationUser> userManager, UrlEncoder urlEncoder, Fido2Service fido2Service, IDistributedCache distributedCache, IConfiguration configuration) { _userManager = userManager; _urlEncoder = urlEncoder; _fido2Service = fido2Service; _distributedCache = distributedCache; _configuration = configuration; _fido2 = new Fido2(new Fido2Configuration() { ServerDomain = _configuration["Fido2ServerDomain"], ServerName = "MyScimApp", Origin = _configuration["Fido2Origin"] }); }
private async Task SignInWithSecurityKeyAsync() { try { AuthenticationStep = AuthenticationStep.SecurityKeyAuthentication; SecurityKeySignInModel.AuthenticatorAssertionRawResponse = await Fido2Service.MakeAssertionRawResponse(UserEmailModel.Email, JSRuntime); var response = await IdentityApiClient.LoginWithFido2Async(SecurityKeySignInModel); response.ThrowIfFailed(); NavigationManager.NavigateTo(ReturnUrl, true); } catch (Exception ex) { Logger.LogError(ex.Message); AuthenticationStep = AuthenticationStep.SecurityKeyError; } }
public AccountController( UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signInManager, IIdentityServerInteractionService interaction, ApplicationDbContext applicationDbContext, Fido2Service fido2Service, IDistributedCache distributedCache, IConfiguration configuration) { _userManager = userManager; _signInManager = signInManager; _interaction = interaction; _applicationDbContext = applicationDbContext; _fido2Service = fido2Service; _distributedCache = distributedCache; _configuration = configuration; _fido2 = new Fido2(new Fido2Configuration() { ServerDomain = _configuration["Fido2ServerDomain"], ServerName = "MyScimApp", Origin = _configuration["Fido2Origin"] }); }
public Fido2Controller(UserManager <ApplicationUser> userManager, Fido2Service fido2Service) { _userManager = userManager; _fido2Service = fido2Service; }