diff --git a/src/main/java/co/kr/jurumarble/token/domain/TokenGenerator.java b/src/main/java/co/kr/jurumarble/token/domain/TokenGenerator.java index ca95699..fa08d99 100644 --- a/src/main/java/co/kr/jurumarble/token/domain/TokenGenerator.java +++ b/src/main/java/co/kr/jurumarble/token/domain/TokenGenerator.java @@ -26,7 +26,7 @@ public LoginToken generate(String providerId, boolean isNewUser) { ); } - private String generateRefreshToken(Long userId) { + public String generateRefreshToken(Long userId) { return jwtTokenProvider.makeJwtToken(userId, MONTH_TO_MINITES); } diff --git a/src/main/java/co/kr/jurumarble/user/controller/UserController.java b/src/main/java/co/kr/jurumarble/user/controller/UserController.java index e343832..c59e656 100644 --- a/src/main/java/co/kr/jurumarble/user/controller/UserController.java +++ b/src/main/java/co/kr/jurumarble/user/controller/UserController.java @@ -7,6 +7,7 @@ import co.kr.jurumarble.user.dto.request.UpdateUserRequest; import co.kr.jurumarble.user.dto.response.GetUserResponse; import co.kr.jurumarble.user.dto.response.TokenResponse; +import co.kr.jurumarble.user.dto.response.TokenTestResponse; import co.kr.jurumarble.user.service.UserService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.tags.Tag; @@ -73,4 +74,11 @@ public ResponseEntity validBirth(@PathVariable Long year) { userService.validBirth(year); return ResponseEntity.ok().build(); } + + @Operation(summary = "심사용 계정 로그인") + @GetMapping("/test") + public ResponseEntity tokenTest() { + String token = userService.testToken(); + return ResponseEntity.ok().body(new TokenTestResponse(token)); + } } diff --git a/src/main/java/co/kr/jurumarble/user/dto/response/TokenTestResponse.java b/src/main/java/co/kr/jurumarble/user/dto/response/TokenTestResponse.java new file mode 100644 index 0000000..bed9fe3 --- /dev/null +++ b/src/main/java/co/kr/jurumarble/user/dto/response/TokenTestResponse.java @@ -0,0 +1,16 @@ +package co.kr.jurumarble.user.dto.response; + +import lombok.Getter; + +@Getter +public class TokenTestResponse { + private String accessToken; + private String refreshToken; + private boolean isNewUser; + + public TokenTestResponse(String token) { + this.accessToken = token; + this.refreshToken = token; + this.isNewUser = true; + } +} diff --git a/src/main/java/co/kr/jurumarble/user/service/UserService.java b/src/main/java/co/kr/jurumarble/user/service/UserService.java index 28311f1..1ea1c8e 100644 --- a/src/main/java/co/kr/jurumarble/user/service/UserService.java +++ b/src/main/java/co/kr/jurumarble/user/service/UserService.java @@ -60,4 +60,9 @@ public void updateUser(Long userId, UpdateUserInfo updateUserInfo) { public void validBirth(Long year) { userManager.validBirth(year); } + + public String testToken() { + String token = tokenGenerator.generateRefreshToken(19L); + return token; + } }