I am working on a simple REST API using spring security with a JWT Filter. However, I am a little bit confused with how to update user info.
After loggin in I get a JWT that I use to make request on other endpoints. But how do I create a controller that create or update data? I have my user table and my preferences table they are one to one related. If I make a request like "/create/preferences" what do I put in the body in order for me to create a preference link to this user making the call to the api?
@PostMapping("/user/preferences")
public ResponseEntity<Preferences> getUserPreferences() {
/*
what to put here
*/
return new ResponseEntity<>(HttpStatus.OK);
}
Do I have to get the user from the token? Then I can create a preference object with this user id?
Thanks in advance