use of org.neo4j.graphdb.security.URLAccessRule in project neo4j by neo4j.
the class URLAccessRules method combined.
public static URLAccessRule combined(final Map<String, URLAccessRule> urlAccessRules) {
return new URLAccessRule() {
@Override
public URL validate(Configuration config, URL url) throws URLAccessValidationError {
String protocol = url.getProtocol();
URLAccessRule protocolRule = urlAccessRules.get(protocol);
if (protocolRule == null) {
throw new URLAccessValidationError("loading resources via protocol '" + protocol + "' is not permitted");
}
return protocolRule.validate(config, url);
}
};
}
use of org.neo4j.graphdb.security.URLAccessRule in project neo4j by neo4j.
the class GraphDatabaseDependencies method newDependencies.
public static GraphDatabaseDependencies newDependencies() {
List<KernelExtensionFactory<?>> kernelExtensions = new ArrayList<>();
for (KernelExtensionFactory factory : Service.load(KernelExtensionFactory.class)) {
kernelExtensions.add(factory);
}
Map<String, URLAccessRule> urlAccessRules = new HashMap<>();
urlAccessRules.put("http", URLAccessRules.alwaysPermitted());
urlAccessRules.put("https", URLAccessRules.alwaysPermitted());
urlAccessRules.put("ftp", URLAccessRules.alwaysPermitted());
urlAccessRules.put("file", URLAccessRules.fileAccess());
List<QueryEngineProvider> queryEngineProviders = asList(Service.load(QueryEngineProvider.class));
return new GraphDatabaseDependencies(null, null, new ArrayList<>(), kernelExtensions, urlAccessRules, queryEngineProviders);
}
Aggregations