@Override
	/**
	 * Checks whether a user has supplied valid credentials
	 */
	public boolean authenticate(String username, String password,
			ServerSession session) {
		renameThread();
		if (username.equals(DEFAULT_USER) && password.equals(DEFAULT_PASS)) {
			SSHManager.limitedUser = true;
			SSHManager.username = DEFAULT_USER;
			SSHManager.session = session;
			Logger.log("Successful Guest login");
			return true;
		}

		boolean valid = false;

		try {
			int id = UserStatementMaker.getId(username);
			byte[] saltedPass = UserStatementMaker.saltPass(id,
					password.getBytes());
			byte[] storedPass = UserStatementMaker.getPass(id);
			valid = Arrays.equals(saltedPass, storedPass);
		} catch (SQLException | UnknownUserException e) {
			Logger.logError("Error during login: " + e);
			return false;
		}

		if (valid) {
			Logger.log("Successful login for " + username);
			SSHManager.limitedUser = false;
			SSHManager.username = username;
			SSHManager.session = session;
		} else
			Logger.log("Login Failed for " + username
					+ " (passwords did not match)");

		return valid;
	}