I've seen a lot of code samples that look like this :
@RequestMapping("/user/{id}"}
@PreAuthorize("principal.userId == #id"}
public String getUrl(@PathVariable("id") Long id){
}
I don't understand how it is possible to have access to "userId" from the principal object directly. The only attribute I have access to when I try this is the name.