use of com.baidu.hugegraph.rpc.RpcClientProviderWithAuth in project incubator-hugegraph by apache.
the class StandardAuthenticator method setup.
@Override
public void setup(HugeConfig config) {
String graphName = config.get(ServerOptions.AUTH_GRAPH_STORE);
Map<String, String> graphConfs = ConfigUtil.scanGraphsDir(config.get(ServerOptions.GRAPHS));
String graphPath = graphConfs.get(graphName);
E.checkArgument(graphPath != null, "Can't find graph name '%s' in config '%s' at " + "'rest-server.properties' to store auth information, " + "please ensure the value of '%s' matches it correctly", graphName, ServerOptions.GRAPHS, ServerOptions.AUTH_GRAPH_STORE.name());
HugeConfig graphConfig = new HugeConfig(graphPath);
if (config.getProperty(INITING_STORE) != null && config.getBoolean(INITING_STORE)) {
// Forced set RAFT_MODE to false when initializing backend
graphConfig.setProperty(CoreOptions.RAFT_MODE.name(), "false");
}
this.graph = (HugeGraph) GraphFactory.open(graphConfig);
String remoteUrl = config.get(ServerOptions.AUTH_REMOTE_URL);
if (StringUtils.isNotEmpty(remoteUrl)) {
RpcClientProviderWithAuth clientProvider = new RpcClientProviderWithAuth(config);
this.graph.switchAuthManager(clientProvider.authManager());
}
}
Aggregations