Method signature leads to error for unauthenticated users
Closed this issue · 1 comments
Schlossgeist commented
@GetMapping("/cart")
@PreAuthorize("isAuthenticated()")
String cart(Cart cart, Model model, @LoggedIn UserAccount userAccount) {
...
}
Workaround: Use Optional<UserAccount>
as suggested by the error page
odrotbohm commented
We decided to refrain from throwing the parameter resolution exception if we find the target method to be guarded by security annotations like @PreAuthorize
/@Secured
.