<commit_before>/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */
package org.elasticsearch.shield;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.ActionRequest;
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;
//    }
//}<commit_msg>uncommented security filter now that the action filter chain is in<commit_after>/*
 * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
 * or more contributor license agreements. Licensed under the Elastic License;
 * you may not use this file except in compliance with the Elastic License.
 */
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 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;
    }
}
{'fraction_non_alphanumeric': 0.08061538461538462, 'fraction_numerical': 0.0, 'mean_word_length': 4.510169491525423, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5999941', 'n_tokens_mistral': 757, 'n_tokens_neox': 761, 'n_words': 209}