Skip to content

Commit

Permalink
πŸ› [FIX] CORS 였λ₯˜ ν•΄κ²° λΆˆν•„μš” μ½”λ“œ μ‚­μ œ
Browse files Browse the repository at this point in the history
  • Loading branch information
ddongseop committed Jan 17, 2024
1 parent f82918c commit 696ac3d
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,10 @@
import org.springframework.context.annotation.Configuration;
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.WebSecurityCustomizer;
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.config.http.SessionCreationPolicy;
import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
import org.springframework.web.filter.CorsFilter;

import static org.sopt.lequuServer.global.auth.security.AuthWhiteList.AUTH_WHITELIST;

Expand Down Expand Up @@ -42,24 +38,4 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
.addFilterBefore(jwtExceptionFilter, JwtAuthenticationFilter.class)
.build();
}

@Bean
public CorsFilter corsFilter() {
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();

CorsConfiguration config = new CorsConfiguration();
config.setAllowCredentials(true);
config.addAllowedOrigin("*");
config.addAllowedHeader("*");
config.addAllowedMethod("*");
source.registerCorsConfiguration("/v3/api-docs", config);
return new CorsFilter(source);
}

@Bean
public WebSecurityCustomizer webSecurityCustomizer() {
return web -> web.ignoring().requestMatchers(
"/swagger-ui/**", "/swagger-resources/**", "/api-docs/**",
"/v3/api-docs/**", "/webjars/**");
}
}
4 changes: 0 additions & 4 deletions src/main/resources/logback-dev.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
<logger name="org.springframework.context.support.PostProcessorRegistrationDelegate" level="WARN"/>
<logger name="org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"
level="WARN"/>
<logger name="org.springframework.security.config.annotation.web.builders.WebSecurity"
level="ERROR"/>
<logger name="org.springframework.security.web.DefaultSecurityFilterChain"
level="ERROR"/>
</springProfile>

</configuration>
4 changes: 0 additions & 4 deletions src/main/resources/logback-local.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,5 @@
<logger name="org.springframework.context.support.PostProcessorRegistrationDelegate" level="WARN"/>
<logger name="org.springframework.data.repository.config.RepositoryConfigurationExtensionSupport"
level="WARN"/>
<logger name="org.springframework.security.config.annotation.web.builders.WebSecurity"
level="ERROR"/>
<logger name="org.springframework.security.web.DefaultSecurityFilterChain"
level="ERROR"/>
</springProfile>
</configuration>

0 comments on commit 696ac3d

Please sign in to comment.