Skip to content

Commit

Permalink
[BOOK-32]-feat: cors에 http 경로도 표시
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeHanEum committed Oct 12, 2024
1 parent 7e9e7c4 commit 28fa3e1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
31 changes: 16 additions & 15 deletions src/main/java/goorm/unit/booklog/common/config/SecurityConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.web.cors.CorsConfiguration;
import org.springframework.web.cors.CorsConfigurationSource;
import org.springframework.web.cors.UrlBasedCorsConfigurationSource;

import goorm.unit.booklog.common.auth.application.UserDetailService;
import goorm.unit.booklog.common.auth.filter.TokenAuthenticationFilter;
Expand Down Expand Up @@ -75,20 +74,22 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
"/",
};

@Bean
public CorsConfigurationSource corsConfigurationSource() {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedHeaders(Arrays.asList("Authorization", "Content-Type", "X-Requested-With", "*"));
config.setAllowedMethods(Arrays.asList("GET", "POST", "PUT", "DELETE", "OPTIONS"));
config.setAllowedOriginPatterns(Arrays.asList(
"http://localhost:5173",
"https://team1-booklog.vercel.app/",
"https://api-booklog.ezbooks.kr/"
));
config.setAllowCredentials(true);
UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();
source.registerCorsConfiguration("/**", config);
return source;
CorsConfigurationSource corsConfigurationSource() {
return request -> {
CorsConfiguration config = new CorsConfiguration();
config.setAllowedHeaders(Collections.singletonList("*"));
config.setAllowedMethods(Collections.singletonList("*"));
config.setAllowedOriginPatterns(
Arrays.asList(
"http://localhost:5173",
"https://team1-booklog.vercel.app/",
"http://58.238.255.245:8080/",
"http://api-booklog.ezbooks.kr/",
"https://api-booklog.ezbooks.kr/"
));
config.setAllowCredentials(true);
return config;
};
}

@Bean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,11 @@ public ResponseEntity<BookSummaryResponse> getBookIdByIsbn(

@Operation(summary = "유저 활동 내역 조회", description = " 작성한 독후감의 수와 읽은 책의 수, 표지, 제목을 반환합니다.")
@ApiResponses({
@ApiResponse(
responseCode = "200",
description = "유저 활동 내역 조회 성공",
content = @Content(schema = @Schema(implementation = BookPageResponse.class))

)
@ApiResponse(
responseCode = "200",
description = "유저 활동 내역 조회 성공",
content = @Content(schema = @Schema(implementation = UserBookListResponse.class))
)
})
@GetMapping("/me")
public ResponseEntity<UserBookListResponse> getMyBookList() {
Expand Down

0 comments on commit 28fa3e1

Please sign in to comment.