<commit_before>package eu.solidcraft.starter.conf.security

import com.google.common.annotations.VisibleForTesting
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.security.authentication.AuthenticationManager
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
import eu.solidcraft.starter.conf.Profiles

@Configuration
@EnableWebSecurity
@Profile([Profiles.DEFAULT, Profiles.DEVELOPMENT, Profiles.TEST])
class HttpBasicSecurityConfig extends WebSecurityConfigurerAdapter {
    @VisibleForTesting public static final String USERNAME = "test"
    @VisibleForTesting public static final String PASSWORD = "<PASSWORD>"

    @Override
    protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
        auth.
            inMemoryAuthentication().
                withUser(USERNAME).
                password(PASSWORD).
                roles("ADMIN")
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.
            authorizeRequests().<commit_msg>csrf disabled<commit_after>package eu.solidcraft.starter.conf.security

import com.google.common.annotations.VisibleForTesting
import org.springframework.context.annotation.Bean
import org.springframework.context.annotation.Configuration
import org.springframework.context.annotation.Profile
import org.springframework.security.authentication.AuthenticationManager
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
import org.springframework.security.config.annotation.web.builders.HttpSecurity
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
import eu.solidcraft.starter.conf.Profiles

@Configuration
@EnableWebSecurity
@Profile([Profiles.DEFAULT, Profiles.DEVELOPMENT, Profiles.TEST])
class HttpBasicSecurityConfig extends WebSecurityConfigurerAdapter {
    @VisibleForTesting public static final String USERNAME = "test"
    @VisibleForTesting public static final String PASSWORD = "<PASSWORD>"

    @Override
    protected void registerAuthentication(AuthenticationManagerBuilder auth) throws Exception {
        auth.
            inMemoryAuthentication().
                withUser(USERNAME).
                password(PASSWORD).
                roles("ADMIN")
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        http.
            csrf().disable().
            authorizeRequests().
{'fraction_non_alphanumeric': 0.07402511566424323, 'fraction_numerical': 0.0, 'mean_word_length': 4.722117202268431, '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': '2019343', 'n_tokens_mistral': 690, 'n_tokens_neox': 677, 'n_words': 133}