Skip to content

Commit

Permalink
Merge pull request #33 from DoTheZ-Team/develop
Browse files Browse the repository at this point in the history
Main Merge JWT token add BlogId
  • Loading branch information
anselmo228 authored Jun 7, 2024
2 parents 66d2630 + 3932014 commit 0c4b6a8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
import com.justdo.plug.auth.global.jwt.kakao.preVersion.dto.response.KakaoTokenResponse;
import com.justdo.plug.auth.global.jwt.kakao.preVersion.dto.response.KakaoUserInfoResponse;
import com.justdo.plug.auth.global.response.code.status.ErrorStatus;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@RequiredArgsConstructor
Expand All @@ -47,7 +48,7 @@ public JwtTokenResponse processKakaoLogin(String code) {
String accessToken = jwtTokenProvider.generateAccessToken(resultMap.get("memberId"), resultMap.get("blogId"));
String refreshToken = jwtTokenProvider.generateRefreshToken(resultMap.get("memberId"));

return JwtTokenResponse.createJwtTokenResponse(accessToken, refreshToken);
return JwtTokenResponse.createJwtTokenResponse(accessToken, refreshToken,resultMap.get("blogId"));
}

private Map<String, Long> registerMemberIfNew(KakaoUserInfoResponse userInfo) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,20 @@ public class JwtTokenResponse {

private final String accessToken;
private final String refreshToken;
private final Long blogId;

@Builder
public JwtTokenResponse(String accessToken, String refreshToken) {
public JwtTokenResponse(String accessToken, String refreshToken, Long blogId) {
this.accessToken = accessToken;
this.refreshToken = refreshToken;
this.blogId = blogId;
}

public static JwtTokenResponse createJwtTokenResponse(String accessToken, String refreshToken) {
public static JwtTokenResponse createJwtTokenResponse(String accessToken, String refreshToken,Long blogId) {
return JwtTokenResponse.builder()
.accessToken(accessToken)
.refreshToken(refreshToken)
.blogId(blogId)
.build();
}
}

0 comments on commit 0c4b6a8

Please sign in to comment.