[api] swagger 셋팅중
- cors 추가
This commit is contained in:
@@ -0,0 +1,44 @@
|
|||||||
|
package com.alist.api.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.web.cors.CorsConfiguration;
|
||||||
|
import org.springframework.web.cors.CorsConfigurationSource;
|
||||||
|
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class CorsConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public CorsConfigurationSource corsConfigurationSource() {
|
||||||
|
CorsConfiguration configuration = new CorsConfiguration();
|
||||||
|
|
||||||
|
configuration.setAllowedOrigins(Arrays.asList(
|
||||||
|
"http://localhost",
|
||||||
|
"http://localhost:8100",
|
||||||
|
"http://localhost:8101",
|
||||||
|
"http://localhost:8102",
|
||||||
|
"http://localhost:8103",
|
||||||
|
"http://localhost:8104",
|
||||||
|
"http://localhost:8105",
|
||||||
|
"https://wwwL-ALlist.pjt.kr",
|
||||||
|
"https://engL-ALlist.pjt.kr",
|
||||||
|
"https://admin-ALlist.pjt.kr",
|
||||||
|
"https://v-Campus-ALlist.pjt.kr",
|
||||||
|
"https://class-ALlist.pjt.kr",
|
||||||
|
"https://student-ALlist.pjt.kr"
|
||||||
|
));
|
||||||
|
|
||||||
|
configuration.setAllowCredentials(true);
|
||||||
|
configuration.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS"));
|
||||||
|
configuration.setAllowedHeaders(Arrays.asList("*"));
|
||||||
|
configuration.setExposedHeaders(Arrays.asList("Authorization", "Set-Cookie"));
|
||||||
|
configuration.setMaxAge(3600L);
|
||||||
|
|
||||||
|
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
|
||||||
|
source.registerCorsConfiguration("/**", configuration);
|
||||||
|
return source;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -53,6 +53,7 @@ public class SecurityConfig {
|
|||||||
@Order(2)
|
@Order(2)
|
||||||
public SecurityFilterChain apiFilterChain(HttpSecurity http, JwtAuthenticationFilter jwtAuthenticationFilter) throws Exception {
|
public SecurityFilterChain apiFilterChain(HttpSecurity http, JwtAuthenticationFilter jwtAuthenticationFilter) throws Exception {
|
||||||
http
|
http
|
||||||
|
.cors(Customizer.withDefaults())
|
||||||
.csrf(csrf -> csrf.disable())
|
.csrf(csrf -> csrf.disable())
|
||||||
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
.sessionManagement(sm -> sm.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
|
||||||
.exceptionHandling(ex -> ex
|
.exceptionHandling(ex -> ex
|
||||||
|
|||||||
Reference in New Issue
Block a user