Skip to content

Commit

Permalink
hotfix: 소셜로그인 url 요청에 대한 redirect가 아닌 일반 body 응답으로 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
TaeyeonRoyce committed Aug 9, 2024
1 parent d436d1a commit aab0fba
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import jakarta.servlet.http.HttpServletRequest
import org.slf4j.LoggerFactory
import org.springframework.http.HttpStatus.NOT_FOUND
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.MissingRequestValueException
import org.springframework.web.bind.annotation.ExceptionHandler
import org.springframework.web.bind.annotation.RestControllerAdvice
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException
Expand Down Expand Up @@ -65,6 +66,23 @@ class ExceptionControllerAdvice {
)
}

@ExceptionHandler(MissingRequestValueException::class)
fun handleMissingRequestValueException(
request: HttpServletRequest,
e: MissingRequestValueException,
): ResponseEntity<ExceptionResponse> {
log.warn(
"""
요청에 필요한 값이 누락되었습니다.
URI: ${request.requestURI}
내용: ${e.message}
""",
)
return ResponseEntity.badRequest().body(
ExceptionResponse("요청에 필요한 값이 누락되었습니다."),
)
}

@ExceptionHandler(Exception::class)
fun handleException(
request: HttpServletRequest,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import io.swagger.v3.oas.annotations.Parameter
import io.swagger.v3.oas.annotations.enums.ParameterIn
import io.swagger.v3.oas.annotations.security.SecurityRequirement
import io.swagger.v3.oas.annotations.tags.Tag
import jakarta.servlet.http.HttpServletResponse
import org.springframework.http.HttpHeaders
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand Down Expand Up @@ -59,8 +58,7 @@ interface SocialLoginApi {
example = "http://localhost:3000",
)
@RequestHeader(HttpHeaders.ORIGIN) requestOrigin: String,
response: HttpServletResponse,
)
): String

@SecurityRequirement(name = "JWT")
@Operation(summary = "소셜 회원 탈퇴")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import com.celuveat.member.application.port.`in`.WithdrawSocialLoginUseCase
import com.celuveat.member.application.port.`in`.command.SocialLoginCommand
import com.celuveat.member.application.port.`in`.command.WithdrawSocialLoginCommand
import com.celuveat.member.domain.SocialLoginType
import jakarta.servlet.http.HttpServletResponse
import org.springframework.http.HttpHeaders
import org.springframework.http.ResponseEntity
import org.springframework.web.bind.annotation.DeleteMapping
Expand Down Expand Up @@ -44,10 +43,9 @@ class SocialLoginController(
override fun redirectLoginUrl(
@PathVariable socialLoginType: SocialLoginType,
@RequestHeader(HttpHeaders.ORIGIN) requestOrigin: String,
response: HttpServletResponse,
) {
): String {
val socialLoginUrl = getSocialLoginUrlUseCase.getSocialLoginUrl(socialLoginType, requestOrigin)
response.sendRedirect(socialLoginUrl)
return socialLoginUrl
}

@DeleteMapping("/withdraw/{socialLoginType}")
Expand Down

0 comments on commit aab0fba

Please sign in to comment.