uncommented security filter now that the action filter chain is in

Original commit: elastic/x-pack-elasticsearch@5b96b80409
This commit is contained in:
javanna 2014-07-28 22:56:45 +02:00 committed by Luca Cavanna
parent 0b751b12f1
commit 3a4af4c7bc
1 changed files with 26 additions and 28 deletions

View File

@ -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;
// }
//}