diff --git a/Api/src/main/java/com/catchyou/api/auth/controller/AuthResponse.java b/Api/src/main/java/com/catchyou/api/auth/controller/AuthResponse.java index 080f0ca..4168929 100644 --- a/Api/src/main/java/com/catchyou/api/auth/controller/AuthResponse.java +++ b/Api/src/main/java/com/catchyou/api/auth/controller/AuthResponse.java @@ -1,5 +1,6 @@ package com.catchyou.api.auth.controller; +import com.catchyou.domain.user.entity.User; import com.catchyou.domain.user.enums.Role; import lombok.Builder; import lombok.Getter; @@ -18,17 +19,20 @@ public class AuthResponse { private Long accessTokenExpireDate; + private String userName; + private Role role; public static AuthResponse of( - String accessToken, String refreshToken, Long userId, Long accessTokenExpireDate, Role role + String accessToken, String refreshToken, User user, Long accessTokenExpireDate ){ return AuthResponse.builder() .accessToken(accessToken) .refreshToken(refreshToken) - .userId(userId) + .userId(user.getId()) .accessTokenExpireDate(accessTokenExpireDate) - .role(role) + .userName(user.getName()) + .role(user.getRole()) .build(); } } diff --git a/Api/src/main/java/com/catchyou/api/auth/service/AuthService.java b/Api/src/main/java/com/catchyou/api/auth/service/AuthService.java index 1747d5a..429e408 100644 --- a/Api/src/main/java/com/catchyou/api/auth/service/AuthService.java +++ b/Api/src/main/java/com/catchyou/api/auth/service/AuthService.java @@ -85,9 +85,8 @@ private AuthResponse createAuthResponse(User user){ return AuthResponse.of( resolveAccessToken(user.getId(), user.getRole().getAuthority()), resolveRefreshToken(user.getId()), - user.getId(), - jwtProvider.getAccessTokenTTlSecond(), - user.getRole() + user, + jwtProvider.getAccessTokenTTlSecond() ); } }