Exemplo n.º 1
0
        public bool ValidateUser(string username, string password, int apiEwId = 0)
        {
            var   isValid = false;
            ApiEw apiEw   = null;
            EarthwatcherRepository earthwatcherRepo = new EarthwatcherRepository(connectionString);

            if (apiEwId != 0)
            {
                apiEw = earthwatcherRepo.GetApiEwById(apiEwId);
            }
            if (apiEw == null)
            {
                var credentials = CredentialsRepository.GetCredentials(connectionString, username);
                isValid = PasswordChecker.CheckPassword(password, credentials.Prefix, credentials.Hash);
            }
            else
            {
                //TODO: Validacion de AccessToken, por ahora si entro con una api lo manda derecho
                isValid = true;
            }
            return(isValid);
        }