<commit_before>/*
 * MIT Licence
 * Copyright (c) 2017 <NAME>
 *
 * Please see LICENCE.md for complete licence text.
 */
package eu.fraho.spring.example;

import eu.fraho.spring.securityJwt.JwtAuthenticationEntryPoint;
import eu.fraho.spring.securityJwt.config.WebSecurityConfig;
import eu.fraho.spring.securityJwt.service.JwtTokenService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;

@Configuration
@Slf4j
@Order(101)
public class CustomSecurityConfig extends WebSecurityConfig {
    public CustomSecurityConfig(final JwtAuthenticationEntryPoint unauthorizedHandler,
                                final UserDetailsService userDetailsService,
                                final PasswordEncoder passwordEncoder,
                                final JwtTokenService jwtTokenUtil) {
        super(unauthorizedHandler, userDetailsService, passwordEncoder, jwtTokenUtil);
    }

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        super.configure(httpSecurity);

        log.info("Overriding ant matchers");
        httpSecurity
                .authorizeRequests()
                .antMatchers("/public/**").permitAll()
                .anyRequest().authenticated();
    }
}<commit_msg>Make custum security-config more verbose and easier to verify it's working<commit_after>/*
 * MIT Licence
 * Copyright (c) 2017 <NAME>
 *
 * Please see LICENCE.md for complete licence text.
 */
package eu.fraho.spring.example;

import eu.fraho.spring.securityJwt.JwtAuthenticationEntryPoint;
import eu.fraho.spring.securityJwt.config.WebSecurityConfig;
import eu.fraho.spring.securityJwt.service.JwtTokenService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;

import javax.servlet.*;
import java.io.IOException;

@Configuration
@Slf4j
@Order(101)
public class CustomSecurityConfig extends WebSecurityConfig {
    public CustomSecurityConfig(final JwtAuthenticationEntryPoint unauthorizedHandler,
                                final UserDetailsService userDetailsService,
                                final PasswordEncoder passwordEncoder,
                                final JwtTokenService jwtTokenUtil) {
        super(unauthorizedHandler, userDetailsService, passwordEncoder, jwtTokenUtil);
    }

    @Override
    protected void configure(HttpSecurity httpSecurity) throws Exception {
        super.configure(httpSecurity);

        log.info("Overriding ant matchers");
        httpSecurity
                .addFilterBefore(customFilter(), UsernamePasswordAuthenticationFilter.class)
                .authorizeRequests()
                .anyRequest().authenticated();
    }

    @Bean
    public Filter customFilter() {
        return new Filter() {
            @Override
            public void init(FilterConfig filterConfig) throws ServletException {
                log.info("Initializing");
            }

            @Override
            public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
                log.info("Handling request");
                chain.doFilter(request, response);
            }

            @Override
            public void destroy() {
                log.info("Destroying");
            }
        };
    }
}
{'fraction_non_alphanumeric': 0.07968711806404302, 'fraction_numerical': 0.0048887802493277925, 'mean_word_length': 3.162767039674466, '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': '3025773', 'n_tokens_mistral': 1035, 'n_tokens_neox': 980, 'n_words': 205}