public bool IsValid(string login, string passwordHash) { var user = new VtecTeamDBManager().GetUser(login); var result = user != null && user.PasswordHash == passwordHash; if (result) User = user; return result; }
public bool IsValid(string login, string passwordHash) { var user = new VtecTeamDBManager().GetUser(login); var result = user != null && user.PasswordHash == passwordHash; if (result) { User = user; } return(result); }
public string Build(string login, string passwordHash) { if (!new UserCredentialValidator().IsValid(login, passwordHash)) { throw new AuthenticationException(); } var token = Guid.NewGuid().ToString(); var dbManager = new VtecTeamDBManager(); var user = dbManager.GetUser(login); if (user == null) { throw new AuthenticationException(); } if (!dbManager.SaveToken(new Token {TokenString = token, User = user, CreateDate = DateTime.Now})) throw new AuthenticationException("Проблемы с БД"); return token; }
public string Build(string login, string passwordHash) { if (!new UserCredentialValidator().IsValid(login, passwordHash)) { throw new AuthenticationException(); } var token = Guid.NewGuid().ToString(); var dbManager = new VtecTeamDBManager(); var user = dbManager.GetUser(login); if (user == null) { throw new AuthenticationException(); } if (!dbManager.SaveToken(new Token { TokenString = token, User = user, CreateDate = DateTime.Now })) { throw new AuthenticationException("Проблемы с БД"); } return(token); }
public bool IsValid(string tokenText) { var token = new VtecTeamDBManager().GetToken(tokenText); return token != null && !IsExpired(token); }
public bool IsValid(string tokenText) { var token = new VtecTeamDBManager().GetToken(tokenText); return(token != null && !IsExpired(token)); }