Skip to content

[기믕] Chapter 9. Spring Security - JWT, OAuth#142

Merged
ennseo merged 1 commit into
gimeung/mainfrom
gimeung/#135
Jun 1, 2026
Merged

[기믕] Chapter 9. Spring Security - JWT, OAuth#142
ennseo merged 1 commit into
gimeung/mainfrom
gimeung/#135

Conversation

@ennseo
Copy link
Copy Markdown

@ennseo ennseo commented May 31, 2026

✏️ 작업 내용

  • (필수) JWT 토큰 방식의 회원가입, 로그인 구현하고 마이페이지도 워크북과 같은 형식으로 개선하기
    (Swagger에서 테스트하는 사진 & DB에 저장되는 사진 필수!)

1-1) JWT 기반 회원가입 API 호출 및 사용자 정보 저장 성공
image (3)

1-2) 로그인 API 호출 후 JWT Access Token 발급 성공
image (4)

1-3) JWT 인증을 통한 마이페이지 API 호출 성공
image (5)

1-4) 회원가입 정보의 데이터베이스 저장 결과 확인
image (6)

  • (선택) JWT + OAuth 구현하기
    (Spring OAuth-Client를 이용해도 되고 직접 호출하는 방식도 가능)

2-1) 카카오 OAuth 로그인 연동 및 사용자 인증 화면
스크린샷 2026-06-01 004643

2-2) 카카오 로그인 후 발급된 JWT를 이용한 마이페이지 조회 성공
image (7)

#️⃣ 연관된 이슈

closes #135


💡 함께 공유하고 싶은 부분

해당 주차를 공부하면서 함께 이야기하고 싶은 주제를 남겨주세요.

(어려웠던 부분과 해결 과정, 핵심 코드, 참고한 자료 등)


🤔 질문

해당 주차 워크북을 공부하면서 궁금했던 질문들을 남겨주세요.


✅ 워크북 체크리스트

  • 모든 핵심 키워드 정리를 마쳤나요?
  • 핵심 키워드에 대해 완벽히 이해하셨나요?
  • 이론 학습 이후 직접 실습을 해보는 시간을 가졌나요?
  • 미션을 수행하셨나요?
  • 미션을 기록하셨나요?

✅ 컨벤션 체크리스트

  • 디렉토리 구조 컨벤션을 잘 지켰나요?
  • pr 제목을 컨벤션에 맞게 작성하였나요?
  • pr에 해당되는 이슈를 연결하였나요?
  • 적절한 라벨을 설정하였나요?
  • 스터디원들에게 code review를 요청하기 위해 reviewer를 등록하였나요?
  • 닉네임/main 브랜치의 최신 상태를 반영하고 있는지 확인했나요?

📌 주안점

@ennseo ennseo requested review from a team and Copilot May 31, 2026 16:17
@ennseo ennseo self-assigned this May 31, 2026
@ennseo ennseo added the 🚀Week 9 9주차 워크북 미션 label May 31, 2026
@ennseo ennseo changed the title mission/#9 [기믕] Chapter 9. Spring Security - JWT, OAuth May 31, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds JWT-based login and OAuth2 Kakao authentication to the member/security flow, replacing the hard-coded my-page member lookup with the authenticated principal.

Changes:

  • Adds JWT creation/validation, JWT authentication filter, and /api/v1/auth/login.
  • Adds OAuth2 Kakao user loading and success handling that issues JWTs.
  • Updates member auth lookup to use socialType + socialUid.

Reviewed changes

Copilot reviewed 18 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
build.gradle Adds JWT and OAuth2 client dependencies.
SecurityConfig.java Wires JWT filter and OAuth2 login flow.
JwtUtil.java Creates and validates access tokens.
JwtAuthFilter.java Authenticates requests from bearer tokens.
CustomUserDetailsService.java Loads authenticated members by social identity.
CustomOAuthService.java Maps OAuth provider data and creates/loads members.
OAuthSuccessHandler.java Returns JWT after OAuth login success.
AuthMember.java / OAuthMember.java Defines security principals.
Member DTO/controller/service/converter/repository/error/success files Adds login DTO/API/service support and social lookup support.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +65 to +66
filterChain.doFilter(request, response);
} catch (Exception e) {
OAuthDTO dto;
switch (providerId) {
case KAKAO -> {
String email = attributes.get("email") != null ? attributes.get("email").toString() : "";
Comment on lines +45 to +46
Map<String, Object> attributes = oAuthMember.getAttribute("kakao_account");
Map<String, Object> profile = (Map<String, Object>) attributes.get("profile");
Copy link
Copy Markdown

@CokaNuri CokaNuri left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JWT 인증 필터를 생성해 SecurityConfig에 JWT 필터를 잘 삽입하셨습니다!
마이페이지도 @AuthenticationPrincipal로 인증객체를 받아 처리하는걸로 잘 수정하셨어요!

로그인 관련해서 자주 등장하는 개념인 CORS에 대해서도 공부해보시면 좋을 것 같아요.
고생하셨습니다!

@ennseo ennseo merged commit 27d798f into gimeung/main Jun 1, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🚀Week 9 9주차 워크북 미션

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants