diff --git a/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java b/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java index 6a2cca6..b4f68cc 100644 --- a/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java +++ b/src/main/java/org/cmh/backend/authentication/controller/AuthenticationController.java @@ -5,14 +5,12 @@ import lombok.AllArgsConstructor; import lombok.Getter; import lombok.Setter; import org.cmh.backend.Utils.JwtUtil; +import org.cmh.backend.authentication.model.UserHS; import org.cmh.backend.authentication.service.UserService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; @RestController class AuthenticationController { @@ -52,6 +50,16 @@ class AuthenticationController { } } + @GetMapping("/userProfile") + public ResponseEntity getUserProfile(@RequestParam String jwt) { + UserHS user = userService.getUserByUsername(JwtUtil.); + if (user != null) { + return new ResponseEntity<>(user, HttpStatus.OK); + } else { + return new ResponseEntity<>(HttpStatus.NOT_FOUND); + } + } + }