Skip to content

[Feat] 오웬 9주차 과제 제출: JWT 토큰 방식의 회원가입, 로그인, 마이페이지 구현 - #49

Open
tjfdlvTkr wants to merge 1 commit into
owenfrom
week9-owen
Open

[Feat] 오웬 9주차 과제 제출: JWT 토큰 방식의 회원가입, 로그인, 마이페이지 구현#49
tjfdlvTkr wants to merge 1 commit into
owenfrom
week9-owen

Conversation

@tjfdlvTkr

@tjfdlvTkr tjfdlvTkr commented May 24, 2026

Copy link
Copy Markdown

📂 관련 이슈

  • closes #[이슈 번호]

🛠️ 작업 사항

  • .env에 JWT_SECRET_KEY 추가
  • build.gradle 의존성 추가
  • JWT 마이그레이션
  • AuthReqDTO / AuthResDTO 로그인 검증 어노테이션 추가

📸 관련 이미지 (스크린샷 또는 동영상)

  • 회원가입
이미지 2026  5  24  오후 6 31 (1) 이미지 2026  5  24  오후 6 31 이미지 2026  5  24  오후 6 33
  • 로그인
이미지 2026  5  24  오후 6 31 이미지 2026  5  24  오후 6 32
  • Token 사용
이미지 2026  5  24  오후 6 34 이미지 2026  5  24  오후 6 34 (1)
  • 마이페이지 조회
이미지 2026  5  24  오후 6 35

💬 기타 설명

💡 추가적으로 공유할 내용이나 리뷰어에게 전달할 사항이 있다면 작성해 주세요.

@tjfdlvTkr
tjfdlvTkr requested review from guingguing and gyeonseo May 26, 2026 04:11
@tjfdlvTkr tjfdlvTkr self-assigned this May 26, 2026

@guingguing guingguing left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

9주차 과제 수고하셨습니다 ~

Comment on lines 8 to 12
public record SignUp(
Long memberId,
String email,
String name
) {}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

회원가입 응답에 accessToken을 발급 안해주네요! 회원가입 시에도 발급해줘야하지 않나요??

@Value("${jwt.token.secretKey}") String secret,
@Value("${jwt.token.expiration.access}") Long accessExpiration
) {
this.secretKey = Keys.hmacShaKeyFor(Decoders.BASE64.decode(secret));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

워크북에서는 secret.getBytes(StandardCharsets.UTF_8) 방식이었던 것 같아요. 지금 오웬 코드에서는 JWT_SECRET_KEY가 Base64 문자열이어야만 동작할 것 같습니다. 일반 문자열 secret을 넣는 경우 오류가 날 수 있을 것 같아요

@gyeonseo gyeonseo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

오웬 jwt 기반 회원가입, 로그인 다 잘 구현해준 것 같다! 스웨거 테스트도 잘해줬고~ OOAuth 실습도 꼭 해봐서, 데모데이 때 소셜로그인 기반 프로젝트를 진행할 때도 덜 막히고 잘 적용해봤으면 좋겠다 ㅎㅎ 오웬은 항상 미션 무난하게 잘 진행해줘서 별로 걱정이 안되네~! 장기해커톤도 데모데이도 화이팅이야 9주차 미션하느라 수고했어!

.authenticationEntryPoint(customEntryPoint())
);
)
.addFilterBefore(jwtAuthFilter(), UsernamePasswordAuthenticationFilter.class);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

👍


/**
* [9주차] 워크북 스타일 — AuthMember.getMember() 로 Member 직접 사용.
* detached 우려가 있을 경우 id 로 재조회.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

맞아 이 이슈가 있는것도 맞고.. 애초에 AuthMember 가 인증에서 쓰이는 객체잖아? 굳이 도메인까지 넘겨주지 않는게 책임 분리에는 더 좋아보여. 컨트롤러단에서 id만 넘겨주는 것도 고려해보면 좋겠다!

filterChain.doFilter(request, response);

} catch (Exception e) {
// JWT 파싱 실패 / 만료 / 위변조 등 → 401 통일 응답

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

401로 통일해서 응답 내려주는거 자체는 좋은것같은데, 이렇게 Exception으로 잡으면 jwt 관련 에러가 아닌것도 여기서 다 잡힐 수 있을거같아.


} catch (Exception e) {
// JWT 파싱 실패 / 만료 / 위변조 등 → 401 통일 응답
ObjectMapper mapper = new ObjectMapper();

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

요것도 가능하면 빈으로 주입받는게 좋을듯!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants