diff --git a/src/main/java/io/oeid/mogakgo/common/swagger/template/AuthSwagger.java b/src/main/java/io/oeid/mogakgo/common/swagger/template/AuthSwagger.java index ee323cbb..4eccda8b 100644 --- a/src/main/java/io/oeid/mogakgo/common/swagger/template/AuthSwagger.java +++ b/src/main/java/io/oeid/mogakgo/common/swagger/template/AuthSwagger.java @@ -3,6 +3,7 @@ import static org.springframework.http.MediaType.APPLICATION_JSON_VALUE; import io.oeid.mogakgo.core.properties.swagger.error.SwaggerAuthErrorExamples; +import io.oeid.mogakgo.domain.auth.presentation.dto.req.AuthReissueRequest; import io.oeid.mogakgo.domain.auth.presentation.dto.res.AuthAccessTokenResponse; import io.oeid.mogakgo.exception.dto.ErrorResponse; import io.swagger.v3.oas.annotations.Operation; @@ -32,5 +33,5 @@ public interface AuthSwagger { }) ResponseEntity reissue( @Parameter(in = ParameterIn.HEADER, hidden = true) String accessToken, - @Parameter(in = ParameterIn.COOKIE) String refreshToken); + AuthReissueRequest refreshToken); } diff --git a/src/main/java/io/oeid/mogakgo/domain/auth/presentation/AuthController.java b/src/main/java/io/oeid/mogakgo/domain/auth/presentation/AuthController.java index 071f8237..244d2768 100644 --- a/src/main/java/io/oeid/mogakgo/domain/auth/presentation/AuthController.java +++ b/src/main/java/io/oeid/mogakgo/domain/auth/presentation/AuthController.java @@ -2,11 +2,12 @@ import io.oeid.mogakgo.common.swagger.template.AuthSwagger; import io.oeid.mogakgo.domain.auth.application.AuthService; +import io.oeid.mogakgo.domain.auth.presentation.dto.req.AuthReissueRequest; import io.oeid.mogakgo.domain.auth.presentation.dto.res.AuthAccessTokenResponse; import lombok.RequiredArgsConstructor; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.CookieValue; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestHeader; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; @@ -20,9 +21,8 @@ public class AuthController implements AuthSwagger { @PostMapping("/reissue") public ResponseEntity reissue( - @RequestHeader("Authorization") String accessToken, - @CookieValue("refreshToken") String refreshToken) { - var accessTokenDto = authService.reissue(accessToken, refreshToken); + @RequestHeader("Authorization") String accessToken, @RequestBody AuthReissueRequest request) { + var accessTokenDto = authService.reissue(accessToken, request.getRefreshToken()); return ResponseEntity.ok(AuthAccessTokenResponse.of(accessTokenDto.getAccessToken(), null)); } } diff --git a/src/main/java/io/oeid/mogakgo/domain/auth/presentation/dto/req/AuthReissueRequest.java b/src/main/java/io/oeid/mogakgo/domain/auth/presentation/dto/req/AuthReissueRequest.java new file mode 100644 index 00000000..4161a4b8 --- /dev/null +++ b/src/main/java/io/oeid/mogakgo/domain/auth/presentation/dto/req/AuthReissueRequest.java @@ -0,0 +1,14 @@ +package io.oeid.mogakgo.domain.auth.presentation.dto.req; + +import io.swagger.v3.oas.annotations.media.Schema; +import lombok.AllArgsConstructor; +import lombok.Getter; + +@Getter +@AllArgsConstructor +@Schema(description = "토큰 재발급 요청") +public class AuthReissueRequest { + + @Schema(description = "Refresh Token") + private final String refreshToken; +}