content: package org.goormthon.seasonthon.nocheongmaru;
  
  import org.springframework.boot.test.context.TestConfiguration;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Profile;
  import org.springframework.security.config.annotation.web.builders.HttpSecurity;
  import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
  import org.springframework.security.config.http.SessionCreationPolicy;
  import org.springframework.security.web.SecurityFilterChain;
  
  @Profile("test")
  @TestConfiguration
  public class TestSecurityConfig {
      
      @Bean
      public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
          http
              .csrf(AbstractHttpConfigurer::disable)
              .httpBasic(AbstractHttpConfigurer::disable)
              .formLogin(AbstractHttpConfigurer::disable)
              .sessionManagement(s -> s.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
          
          http.authorizeHttpRequests(auth -> {
              auth.requestMatchers(
                  "/oauth2/**", "/login/oauth2/**", "/api/v1/auth/reissue",
                  "/swagger-ui/**", "/v3/api-docs/**", "/swagger-resources/**", "/h2-console/**"
              ).permitAll();
              auth.anyRequest().authenticated();
          });
          
          return http.build();
      }
  }