aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/www/SiteAttributesHandler.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-01-13 17:38:06 +0300
committerGravatar Vitaly Takmazov2023-01-13 18:11:56 +0300
commit35d25bbc9d261e7b5585d0fd1d398dff3ab4a176 (patch)
tree68a4d0b0190635615438343f6f6c52cacc213179 /src/main/java/com/juick/www/SiteAttributesHandler.java
parent8b70eded6c9cc3b9cf634356239701fe65779791 (diff)
Fix OpenAPI generation
* Use HandlerMethodArgumentResolver to pass visitor * Hide visitor from OpenAPI definitions * Drop unused AsciiDoc template
Diffstat (limited to 'src/main/java/com/juick/www/SiteAttributesHandler.java')
-rw-r--r--src/main/java/com/juick/www/SiteAttributesHandler.java15
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;
- }
}