public async Task <IActionResult> LoginView(LoginRequest loginQuery) { if (await accountStore.ValidateCredentialsAsync(loginQuery.Login, loginQuery.Password)) { var account = await accountStore.GetAsync(loginQuery.Login); var properties = new AuthenticationProperties { IsPersistent = true, ExpiresUtc = DateTimeOffset.UtcNow.Add(new TimeSpan(0, 30, 0)) }; await HttpContext.SignInAsync(account.Id.ToString(), account.Login, properties); return(Redirect(loginQuery.ReturnUrl)); } return(View()); }
public async Task GetProfileDataAsync(ProfileDataRequestContext context) { var login = context.Subject.Identity.Name; if (await accountStore.IsExistsAsync(login)) { var account = await accountStore.GetAsync(login); //context.IssuedClaims = new List<Claim>{new Claim("iden", account.Id.ToString())}; } }
public async Task <Account> Handle(RegisterRequest query, IContext context) { //logger.LogInformation("Handle register request"); if (await accountStore.CreateAsync(query.FirstName, query.SecondName, query.Login, query.Password)) { //logger.LogInformation("Successfully register"); return(await accountStore.GetAsync(query.Login)); } //logger.LogError("Error in register"); return(null); }
public Task <List <Account> > Get() { return(_accountStore.GetAsync()); }