Skip to content

Commit

Permalink
[fix] Quota by IP: Use Real-IP header, from nginx procy, when enable
Browse files Browse the repository at this point in the history
[enh] Quota by IP: Allow to allow all request from local IP, or from a IP whitelist
  • Loading branch information
blavenie committed May 16, 2022
1 parent 31718f9 commit 482da3d
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,35 @@
*/

import org.duniter.elasticsearch.rest.AbstractRestPostIndexAction;
import org.duniter.elasticsearch.rest.security.RestQuotaController;
import org.duniter.elasticsearch.rest.security.RestSecurityController;
import org.duniter.elasticsearch.user.service.DeleteHistoryService;
import org.duniter.elasticsearch.user.service.UserService;
import org.elasticsearch.client.Client;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.rest.RestController;
import org.elasticsearch.rest.RestRequest;

import java.util.concurrent.TimeUnit;

public class RestHistoryDeleteIndexAction extends AbstractRestPostIndexAction {

@Inject
public RestHistoryDeleteIndexAction(Settings settings, RestController controller, Client client,
RestSecurityController securityController, DeleteHistoryService service) {
RestSecurityController securityController,
RestQuotaController quotaController,
DeleteHistoryService service) {
super(settings, controller, client, securityController,
DeleteHistoryService.INDEX,
DeleteHistoryService.DELETE_TYPE,
json -> service.indexDeleteFromJson(json, false));

/*quotaController.quota(RestRequest.Method.POST,
String.format("/%s/%s", DeleteHistoryService.INDEX, DeleteHistoryService.DELETE_TYPE),
100,
1,
TimeUnit.MINUTES
);*/
}
}

0 comments on commit 482da3d

Please sign in to comment.