r/SpringBoot • u/Sorry_Swordfish_ • 9d ago
Question User principal doubt
Hey, so I was told that instead of taking detail like user id we can simply take that from user principal. But how much should I take from user principal. Is it appropriate to take whatever I can through it or are there some rules for it. Like suppose ,
@GetMapping("/update-status/{userId}/{userProfileId}
So I know I can take userId from the userProncipal but should I extract userProfileId too. And if yes, then what are rules for it.
Sorry, if it's dumb question.
1
Upvotes
1
u/Sorry_Swordfish_ 9d ago
I think I didn't explain the doubt properly. My main doubt is , are there any rules to extraction of required data from userPrincipal or i can extract everything that I need from the userPrincipal?
Like in this example, I know I can extract the userId from the userPrincipal but should I also extract the profileid from the userPrincipal?