Skip to content

Commit

Permalink
Merge pull request #40 from dnd-side-project/fix/#39
Browse files Browse the repository at this point in the history
헤더 토큰 파싱 버그 수정
  • Loading branch information
youngreal authored Sep 5, 2024
2 parents fbbb66a + 1153511 commit 8519081
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Claims parseClaims(String splitHeader) {
Jws<Claims> claims;
try {
claims = Jwts.parser()
.verifyWith(Keys.hmacShaKeyFor(Base64.getDecoder().decode(String.valueOf(this.secretKey))))
.verifyWith(secretKey)
.build()
.parseSignedClaims(splitHeader);

Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/dnd/dndtravel/config/AuthResolver.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ public Object resolveArgument(MethodParameter parameter, ModelAndViewContainer m
Claims accessClaim = jwtProvider.parseClaims(splitHeaders[1]);

//토큰에 심었던 user 식별자값 유효성 확인
Member member = memberRepository.findById((Long)accessClaim.get(MEMBER_ID_CLAIM))
Integer memberId = (Integer) accessClaim.get(MEMBER_ID_CLAIM);
Member member = memberRepository.findById(memberId.longValue())
.orElseThrow(() -> new RuntimeException("유효하지 않은 토큰 값"));

// 컨트롤러 파라미터로 반환
Expand Down

0 comments on commit 8519081

Please sign in to comment.