로그아웃 추가
서블릿 필터에서 Exception 발생시 처리
This commit is contained in:
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.GetMapping
|
||||
import org.springframework.web.bind.annotation.PostMapping
|
||||
import org.springframework.web.bind.annotation.PutMapping
|
||||
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.RequestParam
|
||||
import org.springframework.web.bind.annotation.RequestPart
|
||||
@@ -29,6 +30,16 @@ class MemberController(private val service: MemberService) {
|
||||
@PostMapping("/login")
|
||||
fun login(@RequestBody loginRequest: LoginRequest) = service.login(loginRequest)
|
||||
|
||||
@PostMapping("/logout")
|
||||
fun logout(
|
||||
@RequestHeader("Authorization") token: String,
|
||||
@AuthenticationPrincipal(expression = "#this == 'anonymousUser' ? null : member") member: Member?
|
||||
) = run {
|
||||
if (member == null) throw SodaException("로그인 정보를 확인해주세요.")
|
||||
|
||||
ApiResponse.ok(service.logout(token.removePrefix("Bearer "), member.id!!))
|
||||
}
|
||||
|
||||
@GetMapping("/info")
|
||||
fun getMemberInfo(
|
||||
@RequestParam container: String?,
|
||||
|
Reference in New Issue
Block a user