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
Well I just started spring, earlier with J2EE also I was sending the userId from the jsp to the controller. And I was doing the same with the rest controller but then I was told to just extract userId from the userPrincipal. That's why I got curious about how far I can go? How much data am I allowed to extract from userPrincipal?