Sisc1 209 be redirect url 프론트로 전달#106
Conversation
…m/SISC-IT/sisc-web into SISC1-209-BE-redirect-url-프론트로-전달
|
Warning Rate limit exceeded@msciki7 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 7 minutes and 46 seconds before requesting another review. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. 📒 Files selected for processing (1)
개요OAuth2 인증 처리 로직이 개선되었습니다. 액세스 및 리프레시 쿠키를 별도로 관리하도록 변경되었으며, 보안 설정이 조정되고, 로깅 성능이 최적화되었습니다. 변경 사항
시퀀스 다이어그램sequenceDiagram
participant Client
participant OAuth2SuccessHandler
participant Browser
Client->>OAuth2SuccessHandler: OAuth2 인증 성공
activate OAuth2SuccessHandler
Note over OAuth2SuccessHandler: 액세스 쿠키 생성<br/>(1시간, HttpOnly, Secure)
OAuth2SuccessHandler->>Browser: Set-Cookie: access=token1
Note over OAuth2SuccessHandler: 리프레시 쿠키 생성<br/>(2주, HttpOnly, Secure)
OAuth2SuccessHandler->>Browser: Set-Cookie: refresh=token2
Note over OAuth2SuccessHandler: 동적 쿼리 파라미터 제거<br/>(이전: ?accessToken=...&name=...)
OAuth2SuccessHandler->>Browser: 리다이렉트 (정적 URL)
deactivate OAuth2SuccessHandler
Browser->>Client: 쿠키 설정 완료 및 리다이렉트
코드 리뷰 예상 노력🎯 2 (단순) | ⏱️ ~12분
연관된 가능한 PR
제안된 검토자
시
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java (1)
92-97: 리다이렉트 동작 변경을 검증하세요.쿼리 파라미터를 통한 데이터 전달이 제거되었습니다:
accessToken,name,userId가 더 이상 URL에 포함되지 않음- 프론트엔드가 이제 쿠키에서 이 정보를 읽어야 함
- 주석 처리된 코드(lines 93-95, 97)는 필요 없다면 삭제하는 것이 좋습니다
프론트엔드가 이 변경사항에 맞게 업데이트되었는지 확인하세요. 특히:
- 프론트엔드가 쿠키에서 access 토큰을 읽도록 수정되었는지
- 사용자 정보(name, userId)를 별도 API 호출로 가져오는지
/oauth/success라우트가 쿼리 파라미터 없이 동작하는지주석 처리된 코드를 제거하여 코드 가독성을 개선하는 것을 고려하세요:
String redirectUrl = "http://localhost:5173/oauth/success"; -// + "?accessToken=" + accessToken -// + "&name=" + URLEncoder.encode(name, StandardCharsets.UTF_8) -// + "&userId=" + userId; - // log.info("[OAuth2 Redirect] {}", redirectUrl); getRedirectStrategy().sendRedirect(request, response, redirectUrl);
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
backend/src/main/java/org/sejongisc/backend/common/auth/config/CustomOAuth2UserService.java(1 hunks)backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java(1 hunks)backend/src/main/java/org/sejongisc/backend/common/auth/config/SecurityConfig.java(1 hunks)
🔇 Additional comments (3)
backend/src/main/java/org/sejongisc/backend/common/auth/config/CustomOAuth2UserService.java (1)
46-48: 로깅 개선이 적절합니다.OAuth2 속성을 디버그 레벨로 변경하여 프로덕션 환경에서 불필요한 로그 출력을 줄이고, 민감할 수 있는 사용자 정보의 노출을 방지합니다.
backend/src/main/java/org/sejongisc/backend/common/auth/config/OAuth2SuccessHandler.java (1)
78-84: Refresh 쿠키 설정은 적절합니다.Refresh 쿠키의 설정(HttpOnly, Secure, SameSite=None, 2주 만료)은 보안 모범 사례를 따르고 있습니다. Access 쿠키 버그가 수정되면 이 구성은 정상적으로 작동할 것입니다.
backend/src/main/java/org/sejongisc/backend/common/auth/config/SecurityConfig.java (1)
88-92: 원본 리뷰 의견이 부정확합니다.제공된 보안 설정은 실제로 충돌이 없습니다. Spring Security는 인가 규칙을 순서대로 평가합니다:
- 라인 82-83의 permitAll() 규칙이 먼저 적용 →
/api/user/id/find,/api/user/password/reset/**에 매칭- 라인 90의 authenticated() 규칙이 그 다음 적용 → 나머지
/api/user/**에 매칭실제 엔드포인트 검증 결과:
/api/user/details→@AuthenticationPrincipal사용 (인증 필요) ✓ 보안 규칙과 일치/api/user/{userId}→ 인증 필요 ✓ 보안 규칙과 일치/api/user/id/find→ 공개 엔드포인트 ✓ permitAll 목록에 포함/api/user/password/reset/*→ 공개 엔드포인트 ✓ permitAll 목록에 포함현재 설정은 Spring Security의 표준 패턴을 따르고 있으며, 의도한 대로 작동합니다. 변경이 필요하지 않습니다.
Likely an incorrect or invalid review comment.
Summary by CodeRabbit
릴리스 노트
보안 개선
최적화