mirror of
https://github.com/honeymoose/OpenSearch.git
synced 2025-02-17 18:35:25 +00:00
uncommented security filter now that the action filter chain is in
Original commit: elastic/x-pack-elasticsearch@5b96b80409
This commit is contained in:
parent
0b751b12f1
commit
3a4af4c7bc
@ -7,37 +7,35 @@ package org.elasticsearch.shield;
|
|||||||
|
|
||||||
import org.elasticsearch.action.ActionListener;
|
import org.elasticsearch.action.ActionListener;
|
||||||
import org.elasticsearch.action.ActionRequest;
|
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.common.inject.Inject;
|
||||||
import org.elasticsearch.shield.authc.AuthenticationService;
|
import org.elasticsearch.shield.authc.AuthenticationService;
|
||||||
import org.elasticsearch.shield.authz.AuthorizationService;
|
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;
|
|
||||||
// }
|
|
||||||
//}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user