Skip to content
Snippets Groups Projects
Commit a4795ed7 authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

Security: Allow to post on <currency>/block/_search

parent e3331904
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,7 @@ duniter.security.enable: true
# Should synchronize data using P2P
#
duniter.data.sync.enable: true
duniter.data.sync.host: data.duniter.fr
duniter.data.sync.host: data.gtest.duniter.fr
duniter.data.sync.port: 80
# ---------------------------------- Duniter4j SMTP server -------------------------
......
......@@ -127,7 +127,7 @@ duniter.blockchain.sync.enable: true
# Duniter node to synchronize
#
duniter.host: gtest.duniter.fr
duniter.host: gtest.duniter.org
duniter.port: 10900
#
......
......@@ -116,13 +116,20 @@ public class PluginInit extends AbstractLifecycleComponent<PluginInit> {
// Index (or refresh) node's currency
Currency currency = injector.getInstance(CurrencyService.class).indexCurrencyFromPeer(peer, true);
// Add access to currency index
// Add access to currency/block index
injector.getInstance(RestSecurityController.class).allowIndexType(RestRequest.Method.GET,
currency.getCurrency(),
BlockchainService.BLOCK_TYPE);
injector.getInstance(RestSecurityController.class).allowPostSearchIndexType(
currency.getCurrency(),
BlockchainService.BLOCK_TYPE);
// Add access to currency/peer index
injector.getInstance(RestSecurityController.class).allowIndexType(RestRequest.Method.GET,
currency.getCurrency(),
BlockchainService.PEER_TYPE);
injector.getInstance(RestSecurityController.class).allowPostSearchIndexType(
currency.getCurrency(),
BlockchainService.PEER_TYPE);
// Index blocks (and listen if new block appear)
injector.getInstance(BlockchainService.class)
......
......@@ -57,6 +57,10 @@ public class RestSecurityController extends AbstractLifecycleComponent<RestSecur
return allow(method, String.format("/%s/%s(/.*)?", index, type));
}
public RestSecurityController allowPostSearchIndexType(String index, String type) {
return allow(RestRequest.Method.POST, String.format("/%s/%s/_search", index, type));
}
public RestSecurityController allowImageAttachment(String index, String type, String field) {
return allow(RestRequest.Method.GET, String.format("/%s/%s/[^/]+/_image/%s.*", index, type, field));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment