<commit_before>package de.otto.edison.authentication;

import com.unboundid.ldap.sdk.*;
import de.otto.edison.authentication.configuration.LdapProperties;
import org.slf4j.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.List;

import static com.unboundid.ldap.sdk.SearchScope.SUB;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toList;
import static org.slf4j.LoggerFactory.getLogger;

/**
 * A HttpServletRequest that is {@link HttpServletRequest#isUserInRole(String) checking the user role}
 * using LDAP search.
 * <p>
 *     In order to check the roles, the roleBaseDn property must be set in
 *     {@link de.otto.edison.authentication.configuration.LdapProperties}
 * </p>
 */
class LdapRoleCheckingRequest extends HttpServletRequestWrapper {

    private static final Logger LOG = getLogger(LdapRoleCheckingRequest.class);
    private static final String CN = "cn";

    private final LDAPInterface ldapInterface;
    private final String userDN;
    private final String roleBaseDN;

    /**
     * Constructs a request object wrapping the given request.
     *
     * @param request The request to wrap
     * @throws IllegalArgumentException if the request is null
     */
    public LdapRoleCheckingRequest(final HttpServletRequest request,
                                   final LDAPInterface ldapInterface,
                                   final String userDN,
                                   final LdapProperties ldapProperties) {
        super(request);
        this.ldapInterface = ldapInterface;
        this.userDN = userDN;
        this.roleBaseDN = ldapProperties.getRoleBaseDn(); //"ou=mesos,ou=groups,dc=lhotse,dc=otto,dc=de";

    }
<commit_msg>cleanup<commit_after>package de.otto.edison.authentication;

import com.unboundid.ldap.sdk.*;
import de.otto.edison.authentication.configuration.LdapProperties;
import org.slf4j.Logger;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.List;

import static com.unboundid.ldap.sdk.SearchScope.SUB;
import static java.util.Arrays.stream;
import static java.util.stream.Collectors.toList;
import static org.slf4j.LoggerFactory.getLogger;

/**
 * A HttpServletRequest that is {@link HttpServletRequest#isUserInRole(String) checking the user role}
 * using LDAP search.
 * <p>
 *     In order to check the roles, the roleBaseDn property must be set in
 *     {@link de.otto.edison.authentication.configuration.LdapProperties}
 * </p>
 */
class LdapRoleCheckingRequest extends HttpServletRequestWrapper {

    private static final Logger LOG = getLogger(LdapRoleCheckingRequest.class);
    private static final String CN = "cn";

    private final LDAPInterface ldapInterface;
    private final String userDN;
    private final String roleBaseDN;

    /**
     * Constructs a request object wrapping the given request.
     *
     * @param request The request to wrap
     * @throws IllegalArgumentException if the request is null
     */
    public LdapRoleCheckingRequest(final HttpServletRequest request,
                                   final LDAPInterface ldapInterface,
                                   final String userDN,
                                   final LdapProperties ldapProperties) {
        super(request);
        this.ldapInterface = ldapInterface;
        this.userDN = userDN;
        this.roleBaseDN = ldapProperties.getRoleBaseDn();
    }

{'fraction_non_alphanumeric': 0.07847597384134206, 'fraction_numerical': 0.0011373329542223485, 'mean_word_length': 3.193087008343266, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2147825', 'n_tokens_mistral': 961, 'n_tokens_neox': 963, 'n_words': 251}