public AuthToken GetNewTokenForUser(ApiUser user) { string key = user.Secret; string data = user.UserName + user.Password + user.GetHashCode() + randomGen.Next(); string hash = _hashProvider.GetHash(key, data); var resultToken = new AuthToken { Value = hash, ApiUser = user, Expiration = DateTime.Now.AddMinutes(DEFAULT_TOKEN_TIME_IN_MINUTES), IsActive = true }; _tokenRespository.Add(resultToken); return resultToken; }
public TokenModel(AuthToken token) { Token = token.Value; ExpirationDate = token.Expiration; }