updated to support database authentication.