diff options
Diffstat (limited to 'src/main/java/com/juick/www/SiteAttributesHandler.java')
-rw-r--r-- | src/main/java/com/juick/www/SiteAttributesHandler.java | 15 |
1 files changed, 0 insertions, 15 deletions
diff --git a/src/main/java/com/juick/www/SiteAttributesHandler.java b/src/main/java/com/juick/www/SiteAttributesHandler.java index 4ead9d1e..0e1ca1db 100644 --- a/src/main/java/com/juick/www/SiteAttributesHandler.java +++ b/src/main/java/com/juick/www/SiteAttributesHandler.java @@ -36,8 +36,6 @@ import javax.inject.Inject; @ControllerAdvice public class SiteAttributesHandler { - @Inject - private UserService userService; @ModelAttribute public void setVaryResponseHeader(HttpServletResponse response) { response.setHeader("Vary", "Accept-Language"); @@ -46,17 +44,4 @@ public class SiteAttributesHandler { public void setReturnPathAttribute(Model model) { model.addAttribute("retpath", ServletUriComponentsBuilder.fromCurrentRequestUri().toUriString()); } - @ModelAttribute - public User visitor(Model model, @AuthenticationPrincipal Object principal) { - if (principal != null) { - if (principal instanceof JuickUser) { - return ((JuickUser) principal).getUser(); - } - if (principal instanceof Jwt) { - var uname = (String) ((Jwt) principal).getClaims().get("sub"); - return userService.getUserByName(uname); - } - } - return AnonymousUser.INSTANCE; - } } |