Skip to content

Commit

Permalink
[FIX] 리프레시 토큰 response DTO 컨벤션에 맞게 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
dragontaek-lee committed Feb 28, 2024
1 parent 5e83778 commit 6d2ec1e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
import static lombok.AccessLevel.PRIVATE;

@Builder(access = PRIVATE)
public record RefreshResponse(
public record TokenRefreshGetResponse(
String accessToken
) {

public static RefreshResponse of(String accessToken) {
return RefreshResponse.builder()
public static TokenRefreshGetResponse of(String accessToken) {
return TokenRefreshGetResponse.builder()
.accessToken(accessToken)
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import org.sopt.makers.operation.web.admin.dto.request.LoginRequest;
import org.sopt.makers.operation.web.admin.dto.request.SignUpRequest;
import org.sopt.makers.operation.web.admin.dto.response.LoginResponse;
import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse;
import org.sopt.makers.operation.web.admin.dto.response.TokenRefreshGetResponse;
import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse;

public interface AdminService {
SignUpResponse signUp(SignUpRequest request);
LoginResponse login(LoginRequest request);
RefreshResponse refresh(String refreshToken);
TokenRefreshGetResponse refresh(String refreshToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import org.sopt.makers.operation.web.admin.dto.response.SignUpResponse;
import org.sopt.makers.operation.web.admin.dto.request.LoginRequest;
import org.sopt.makers.operation.web.admin.dto.response.LoginResponse;
import org.sopt.makers.operation.web.admin.dto.response.RefreshResponse;
import org.sopt.makers.operation.web.admin.dto.response.TokenRefreshGetResponse;
import org.sopt.makers.operation.admin.repository.AdminRepository;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
Expand Down Expand Up @@ -87,13 +87,13 @@ private void checkAdminAllowed(Admin admin) {

@Override
@Transactional
public RefreshResponse refresh(String refreshToken) {
public TokenRefreshGetResponse refresh(String refreshToken) {
val adminId = jwtTokenProvider.getId(refreshToken, JwtTokenType.REFRESH_TOKEN);
val admin = findById(adminId);
validateRefreshToken(admin, refreshToken);
val newAccessToken = generateAccessToken(admin);

return RefreshResponse.of(newAccessToken);
return TokenRefreshGetResponse.of(newAccessToken);
}

public void validateRefreshToken(Admin admin, String refreshToken) {
Expand Down

0 comments on commit 6d2ec1e

Please sign in to comment.