public ApiIdentity(User user) { if (user == null) { throw new ArgumentNullException("User is null"); } User = user; }
public SignIn SignUp(SignUp model) { var salt = SecurityHelper.GenerateSalt(); var passwordHash = SecurityHelper.GeneratePasswordHash(model.Password+salt); var securityToken = SecurityHelper.GenerateSecurityToken(); var user = new User(model.Email, passwordHash) { Salt = salt, FirstName = model.FirstName, LastName = model.LastName, Token = securityToken }; using (var db = _documentStore.OpenSession()) { db.Store(user); db.SaveChanges(); } return SignInUser(user); }
public static void SignInUser(User user) { System.Web.HttpContext.Current.User = new GenericPrincipal(new ApiIdentity(user), new string[] { }); }
private SignIn SignInUser(User user) { UserManagement.SignInUser(user); return new SignIn() { FirsName = user.FirstName, LastName = user.LastName, Id = user.Id, Token = user.Token }; }