diff --git a/src/main/java/com/mpnp/baechelin/user/controller/UserController.java b/src/main/java/com/mpnp/baechelin/user/controller/UserController.java new file mode 100644 index 0000000..cd1e8db --- /dev/null +++ b/src/main/java/com/mpnp/baechelin/user/controller/UserController.java @@ -0,0 +1,23 @@ +package com.mpnp.baechelin.user.controller; + +import com.mpnp.baechelin.login.oauth.common.AuthResponse; +import com.mpnp.baechelin.user.service.UserService; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.http.ResponseEntity; +import org.springframework.security.core.annotation.AuthenticationPrincipal; +import org.springframework.security.core.userdetails.User; +import org.springframework.web.bind.annotation.*; + +@RestController +@RequestMapping("/user") +@RequiredArgsConstructor +public class UserController { + + private final UserService userService; + + @RequestMapping("/logout") + public ResponseEntity logout(@AuthenticationPrincipal User user) { + return null; + } +} diff --git a/src/main/java/com/mpnp/baechelin/user/controller/UserRestController.java b/src/main/java/com/mpnp/baechelin/user/controller/UserRestController.java deleted file mode 100644 index 7e80be5..0000000 --- a/src/main/java/com/mpnp/baechelin/user/controller/UserRestController.java +++ /dev/null @@ -1,34 +0,0 @@ -package com.mpnp.baechelin.user.controller; - -import com.mpnp.baechelin.login.oauth.common.AuthResponse; -import com.mpnp.baechelin.user.domain.User; -import com.mpnp.baechelin.user.service.UserService; -import io.swagger.annotations.ApiOperation; -import lombok.RequiredArgsConstructor; -import org.springframework.security.core.annotation.AuthenticationPrincipal; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -@RestController -@RequestMapping("/user") -@RequiredArgsConstructor -public class UserRestController { - - private final UserService userService; - - @ApiOperation(value = "토큰 테스트용 메소드 (사용하지 않음)") - @GetMapping("/oauth/redirect") - public AuthResponse loginTest(@RequestParam(required = false) String token) { - return AuthResponse.success("access_token", token); - } - - @ApiOperation(value = "유저 정보 가져오기 테스트용 메소드 (사용하지 않음)") - @GetMapping - public AuthResponse getUser(@AuthenticationPrincipal org.springframework.security.core.userdetails.User principal) { - User user = userService.getUser(principal.getUsername()); - - return AuthResponse.success("user", user); - } -}