public ActionResult Index(LoginModel model) { if(!ModelState.IsValid) return View(model); var result = _authenticationService.Authenticate(model); if (!result.IsAuthenticated) return View(model); var token = new AccessToken(result.User.Id); _accessTokenRepository.Save(token); Response.Cookies.Add(new HttpCookie("token", token.Id) { Expires = token.Expires, Path = "/" }); return RedirectToAction("Index", "Security"); }
public void Save(AccessToken entity) { _tokens.Add(entity); }
public void Update(AccessToken entity, string id) { throw new System.NotImplementedException(); }
public void Delete(AccessToken entity) { throw new System.NotImplementedException(); }