From 7b7ceab19875c529f76a155313bdc16e130c2b71 Mon Sep 17 00:00:00 2001 From: Ganghee-Lee-0522 Date: Fri, 12 Jan 2024 23:27:30 +0900 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20oauth2=20=EB=A6=AC=EB=8B=A4?= =?UTF-8?q?=EC=9D=B4=EB=A0=89=EC=85=98=20=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - url 불일치 문제를 해결했습니다. --- .../committersserver/auth/config/SecurityConfig.java | 10 +++++----- .../domain/attack/controller/AttackController.java | 1 + .../domain/follow/controller/FollowController.java | 1 + .../domain/item/controller/ItemController.java | 1 + .../domain/member/controller/MemberController.java | 1 + 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/committers/snowflowerthon/committersserver/auth/config/SecurityConfig.java b/src/main/java/com/committers/snowflowerthon/committersserver/auth/config/SecurityConfig.java index 9725a5f..c8a7b9d 100644 --- a/src/main/java/com/committers/snowflowerthon/committersserver/auth/config/SecurityConfig.java +++ b/src/main/java/com/committers/snowflowerthon/committersserver/auth/config/SecurityConfig.java @@ -90,12 +90,12 @@ protected SecurityFilterChain filterChain(HttpSecurity http) throws Exception { ) // OAuth 2.0 로그인 설정 시작 .oauth2Login( (oauth2Login) -> oauth2Login - .authorizationEndpoint(authorization -> authorization // 인증 엔드포인트 설정 - .baseUri("/login/oauth2/code") // 사용자가 로그인하려고 할 때 리다이렉션되는 기본 URI - - ) // 커스텀 로그인 페이지가 필요하지 않으므로, 로그인 시 리다이렉션이 필요없다. +// .authorizationEndpoint(authorization -> authorization // 인증 엔드포인트 설정 +//// .baseUri("/login/oauth2/code") // 사용자가 로그인하려고 할 때 리다이렉션되는 기본 URI +//// +//// ) // 커스텀 로그인 페이지가 필요하지 않으므로, 로그인 시 리다이렉션이 필요없다. .redirectionEndpoint( redirection -> redirection - .baseUri("/login/oauth2/code") // OAuth 2.0 공급자로부터 코드가 리다이렉션될 때의 기본 URI + .baseUri("/login/oauth2/code/github") // OAuth 2.0 공급자로부터 코드가 리다이렉션될 때의 기본 URI // ) // 리다이렉션 엔드포인트 설정 .successHandler(successHandler) // OAuth 2.0 로그인 성공 시의 핸들러를 설정 diff --git a/src/main/java/com/committers/snowflowerthon/committersserver/domain/attack/controller/AttackController.java b/src/main/java/com/committers/snowflowerthon/committersserver/domain/attack/controller/AttackController.java index 1ba6d37..ec4cb05 100644 --- a/src/main/java/com/committers/snowflowerthon/committersserver/domain/attack/controller/AttackController.java +++ b/src/main/java/com/committers/snowflowerthon/committersserver/domain/attack/controller/AttackController.java @@ -11,6 +11,7 @@ @RestController @RequiredArgsConstructor +@CrossOrigin(origins = "https://kidari.site") @RequestMapping("/api/v1") public class AttackController { diff --git a/src/main/java/com/committers/snowflowerthon/committersserver/domain/follow/controller/FollowController.java b/src/main/java/com/committers/snowflowerthon/committersserver/domain/follow/controller/FollowController.java index 0e7bacb..b414277 100644 --- a/src/main/java/com/committers/snowflowerthon/committersserver/domain/follow/controller/FollowController.java +++ b/src/main/java/com/committers/snowflowerthon/committersserver/domain/follow/controller/FollowController.java @@ -8,6 +8,7 @@ @RestController @RequiredArgsConstructor +@CrossOrigin(origins = "https://kidari.site") @RequestMapping("/api/v1") public class FollowController { private final FollowService followService; diff --git a/src/main/java/com/committers/snowflowerthon/committersserver/domain/item/controller/ItemController.java b/src/main/java/com/committers/snowflowerthon/committersserver/domain/item/controller/ItemController.java index ec96592..866b966 100644 --- a/src/main/java/com/committers/snowflowerthon/committersserver/domain/item/controller/ItemController.java +++ b/src/main/java/com/committers/snowflowerthon/committersserver/domain/item/controller/ItemController.java @@ -8,6 +8,7 @@ @RestController @RequiredArgsConstructor +@CrossOrigin(origins = "https://kidari.site") @RequestMapping("/api/v1/item") public class ItemController { diff --git a/src/main/java/com/committers/snowflowerthon/committersserver/domain/member/controller/MemberController.java b/src/main/java/com/committers/snowflowerthon/committersserver/domain/member/controller/MemberController.java index bb57ff7..c452465 100644 --- a/src/main/java/com/committers/snowflowerthon/committersserver/domain/member/controller/MemberController.java +++ b/src/main/java/com/committers/snowflowerthon/committersserver/domain/member/controller/MemberController.java @@ -11,6 +11,7 @@ @RequiredArgsConstructor @RestController +@CrossOrigin(origins = "https://kidari.site") @RequestMapping("/api/v1") public class MemberController {