<commit_before>package fr.pizzeria.admin.web.filter;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@WebFilter(urlPatterns = { "/*" })
public class ConnexionFilter implements Filter {
	
	private static final String VUE_LOGIN = "/WEB-INF/views/utilisateurs/connexionUtilisateur.jsp";
	
	private static final List<String> ALLOWED_PATHS = Arrays.asList("/login", "/", "/index.jsp", "/static/*", "/utilisateurs/password", "/utilisateur/nouveau");

	@Override
	public void init(FilterConfig config) throws ServletException {

	}

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		HttpSession session = req.getSession();
		
		/* REGEX pour les url autorisées */
		StringBuilder sb = new StringBuilder();
		for (String p : ALLOWED_PATHS) {
			/* Echappe le point afin qu'il soit pris telle quelle dans la regex et non comme un caractère special */<commit_msg>#1 usa001-authentification Passage en review(2)<commit_after>package fr.pizzeria.admin.web.filter;

import java.io.IOException;
import java.util.Arrays;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@WebFilter(urlPatterns = { "/*" })
public class ConnexionFilter implements Filter {
	
	private static final String VUE_LOGIN = "/WEB-INF/views/utilisateurs/connexionUtilisateur.jsp";
	
	private static final List<String> ALLOWED_PATHS = Arrays.asList("/login", "/", "/index.jsp", "/static/*", "/utilisateurs/password");

	@Override
	public void init(FilterConfig config) throws ServletException {

	}

	public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
			throws IOException, ServletException {
		HttpServletRequest req = (HttpServletRequest) request;
		HttpSession session = req.getSession();
		
		/* REGEX pour les url autorisées */
		StringBuilder sb = new StringBuilder();
		for (String p : ALLOWED_PATHS) {
			/* Echappe le point afin qu'il soit pris telle quelle dans la regex et non comme un caractère special */
{'fraction_non_alphanumeric': 0.10278745644599303, 'fraction_numerical': 0.0017421602787456446, 'mean_word_length': 5.422818791946309, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '6443643', 'n_tokens_mistral': 856, 'n_tokens_neox': 822, 'n_words': 219}