Skip to content

Commit 533db15

Browse files
authored
Merge pull request #74 from studio-recoding/dev
[🚀feat] oauth 리다이렉션 URI 이중화
2 parents c0f1cd8 + 45ac08b commit 533db15

File tree

4 files changed

+17
-6
lines changed

4 files changed

+17
-6
lines changed

.github/workflows/prod-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,4 +108,4 @@ jobs:
108108
sudo docker rm $(sudo docker ps -a -q)
109109
sudo docker rmi $(sudo docker images -q)
110110
docker pull jeonhaeseung/ness-server-prod:main
111-
docker run -d --name backend-server -p 8080:8080 --restart unless-stopped jeonhaeseung/ness-server-prod:main
111+
docker run -d --name backend-server -p 80:8080 --restart unless-stopped jeonhaeseung/ness-server-prod:main

src/main/java/Ness/Backend/domain/auth/oAuth/OAuthSuccessHandler.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import jakarta.servlet.http.HttpServletResponse;
88
import lombok.RequiredArgsConstructor;
99
import lombok.extern.slf4j.Slf4j;
10+
import org.springframework.beans.factory.annotation.Value;
1011
import org.springframework.security.core.Authentication;
1112
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
1213
import org.springframework.web.util.UriComponentsBuilder;
@@ -19,6 +20,12 @@
1920
public class OAuthSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
2021
private final JwtTokenProvider jwtTokenProvider;
2122

23+
@Value("frontend.redirect-url")
24+
private String frontRedirectUrl;
25+
26+
@Value("backend.server-name")
27+
private String backServerName;
28+
2229
@Override
2330
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException {
2431

@@ -46,12 +53,12 @@ private String setRedirectUrl(String url) {
4653
if (url.equals("localhost")) {
4754
redirect_url = "http://localhost:8080/oauth/google/success";
4855
}
49-
/* 프론트 개발 환경 */
50-
if (url.equals("api.nessplanning.com")) {
51-
redirect_url = "http://localhost:3000/oauth/google/success/ing";
56+
/* 프론트 개발 또는 프로덕션 환경 */
57+
if (url.equals(backServerName)) {
58+
log.info("backServerName: " + backServerName);
59+
log.info("frontRedirectUrl: " + frontRedirectUrl);
60+
redirect_url = frontRedirectUrl + "/oauth/google/success/ing";
5261
}
53-
//TODO: 프론트 프로덕션 환경만 지원하는 백엔드 구축
54-
5562
return redirect_url;
5663
}
5764
}

src/main/java/Ness/Backend/domain/auth/security/SecurityConfig.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ public CorsConfigurationSource corsConfigurationSource() {
6464
configuration.addAllowedOriginPattern("https://*.nessplanning.com");
6565
configuration.addAllowedOriginPattern("https://*.nessplanning.com:8080");
6666
configuration.addAllowedOriginPattern("https://*.nessplanning.com:3000");
67+
configuration.addAllowedOriginPattern("https://www.nessplanning.com");
6768
configuration.addAllowedOriginPattern("https://api.nessplanning.com:8080");
6869
configuration.addAllowedMethod("*"); //모든 Method 허용(POST, GET, ...)
6970
configuration.addAllowedHeader("*"); //모든 Header 허용

src/main/java/Ness/Backend/domain/chat/ChatService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,9 @@ public PostFastApiAiChatDto postNewAiChat(Long id, String text, ChatType chatTyp
100100
if (personaType == PersonaType.HARDNESS){
101101
persona = "hard";
102102
}
103+
if (personaType == PersonaType.CLAMNESS){
104+
persona = "easy";
105+
}
103106

104107
//TODO: member_id 전달하는 로직 만들어야 하지 않을까?(RAG를 위해)
105108
PostFastApiUserChatDto userDto = PostFastApiUserChatDto.builder()

0 commit comments

Comments
 (0)