private static synchronized void cleanupNeo4jKnownHosts(Neo4jServerLoader neo4jServerLoader) { File hostsFile = Config.defaultConfig().trustStrategy().certFile(); try { if (hostsFile != null && hostsFile.isFile()) { List<String> lines = FileUtil.loadLines(hostsFile); List<String> updatedLines = lines.stream() .filter((line) -> !line.startsWith(neo4jServerLoader.getBoltHost() + ":" + neo4jServerLoader.getBoltPort())) .filter((line) -> !line.isEmpty()) .collect(Collectors.toList()); FileUtil.writeToFile(hostsFile, String.join(System.lineSeparator(), updatedLines) + System.lineSeparator()); } } catch (Exception e) { Throwables.throwIfUnchecked(e); throw new RuntimeException(e); } } }
"Option `TRUST_ON_FIRST_USE` has been deprecated and will be removed in a future " + "version of the driver. Please switch to use `TRUST_ALL_CERTIFICATES` instead." ); return SecurityPlan.forTrustOnFirstUse( trustStrategy.certFile(), hostnameVerificationEnabled, address, logger ); case TRUST_SIGNED_CERTIFICATES: logger.warn( return SecurityPlan.forCustomCASignedCertificates( trustStrategy.certFile(), hostnameVerificationEnabled ); case TRUST_SYSTEM_CA_SIGNED_CERTIFICATES: return SecurityPlan.forSystemCASignedCertificates( hostnameVerificationEnabled );