From 3a4af4c7bcdcd05045a50d799877f91bd0639225 Mon Sep 17 00:00:00 2001 From: javanna Date: Mon, 28 Jul 2014 22:56:45 +0200 Subject: [PATCH] uncommented security filter now that the action filter chain is in Original commit: elastic/x-pack-elasticsearch@5b96b80409477e410d04ce18d1ddc30e44da4b38 --- .../shield/SecurityActionFilter.java | 54 +++++++++---------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/src/main/java/org/elasticsearch/shield/SecurityActionFilter.java b/src/main/java/org/elasticsearch/shield/SecurityActionFilter.java index 9b6b28d09db..b40e42cd12b 100644 --- a/src/main/java/org/elasticsearch/shield/SecurityActionFilter.java +++ b/src/main/java/org/elasticsearch/shield/SecurityActionFilter.java @@ -7,37 +7,35 @@ package org.elasticsearch.shield; import org.elasticsearch.action.ActionListener; import org.elasticsearch.action.ActionRequest; +import org.elasticsearch.action.support.ActionFilter; +import org.elasticsearch.action.support.ActionFilterChain; import org.elasticsearch.common.inject.Inject; import org.elasticsearch.shield.authc.AuthenticationService; import org.elasticsearch.shield.authz.AuthorizationService; -public class SecurityActionFilter { +/** + * + */ +public class SecurityActionFilter implements ActionFilter { + private final AuthenticationService authenticationService; + private final AuthorizationService authorizationService; + + @Inject + public SecurityActionFilter(AuthenticationService authenticationService, AuthorizationService authorizationService) { + this.authenticationService = authenticationService; + this.authorizationService = authorizationService; + } + + @Override + public void process(String action, ActionRequest actionRequest, ActionListener actionListener, ActionFilterChain actionFilterChain) { + User user = authenticationService.authenticate(action, actionRequest); + authorizationService.authorize(user, action, actionRequest); + actionFilterChain.continueProcessing(action, actionRequest, actionListener); + } + + @Override + public int order() { + return Integer.MIN_VALUE; + } } - -///** -// * -// */ -//public class SecurityActionFilter implements ActionFilter { -// -// private final AuthenticationService authenticationService; -// private final AuthorizationService authorizationService; -// -// @Inject -// public SecurityActionFilter(AuthenticationService authenticationService, AuthorizationService authorizationService) { -// this.authenticationService = authenticationService; -// this.authorizationService = authorizationService; -// } -// -// @Override -// public void process(String action, ActionRequest actionRequest, ActionListener actionListener, ActionFilterChain actionFilterChain) { -// User user = authenticationService.authenticate(action, actionRequest); -// authorizationService.authorize(user, action, actionRequest); -// actionFilterChain.continueProcessing(action, actionRequest, actionListener); -// } -// -// @Override -// public int order() { -// return Integer.MIN_VALUE; -// } -//}