添加/userProfile
This commit is contained in:
parent
0a33a40ce1
commit
b04ebb148a
@ -5,14 +5,12 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.cmh.backend.Utils.JwtUtil;
|
import org.cmh.backend.Utils.JwtUtil;
|
||||||
|
import org.cmh.backend.authentication.model.UserHS;
|
||||||
import org.cmh.backend.authentication.service.UserService;
|
import org.cmh.backend.authentication.service.UserService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.http.HttpStatus;
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.http.ResponseEntity;
|
import org.springframework.http.ResponseEntity;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
class AuthenticationController {
|
class AuthenticationController {
|
||||||
@ -52,6 +50,16 @@ class AuthenticationController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/userProfile")
|
||||||
|
public ResponseEntity<UserHS> 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user