From 816db24929732fa3967667ec76d95cbfb01068d1 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Sat, 11 Nov 2023 23:15:01 +0300 Subject: Make sure HTTP requests actually use caching * OkHttp dispatcher is not used for synchronous requests * @Cacheable only works for bean method calls, refactor beans to use it correctly --- .../service/security/HTTPSignatureAuthenticationFilter.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/main/java/com/juick/service/security') diff --git a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java index 55c87383..30cb1512 100644 --- a/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java +++ b/src/main/java/com/juick/service/security/HTTPSignatureAuthenticationFilter.java @@ -17,8 +17,8 @@ package com.juick.service.security; +import com.juick.ActivityPubManager; import com.juick.model.User; -import com.juick.service.ActivityPubService; import com.juick.service.UserService; import com.juick.service.security.entities.JuickUser; import jakarta.servlet.FilterChain; @@ -37,13 +37,13 @@ import java.util.stream.Collectors; public class HTTPSignatureAuthenticationFilter extends BaseAuthenticationFilter { - private final ActivityPubService signatureManager; + private final ActivityPubManager activityPubManager; private final UserService userService; public HTTPSignatureAuthenticationFilter( - final ActivityPubService activityPubService, + final ActivityPubManager activityPubManager, final UserService userService) { - this.signatureManager = activityPubService; + this.activityPubManager = activityPubManager; this.userService = userService; } @@ -54,7 +54,7 @@ public class HTTPSignatureAuthenticationFilter extends BaseAuthenticationFilter Map headers = Collections.list(request.getHeaderNames()) .stream() .collect(Collectors.toMap(String::toLowerCase, request::getHeader)); - var user = signatureManager.verifyActor(request.getMethod(), request.getRequestURI(), headers); + var user = activityPubManager.verifyActor(request.getMethod(), request.getRequestURI(), headers); String userUri = user.getUri().toString(); if (!user.isAnonymous() || userUri.length() > 0) { if (userUri.length() == 0) { -- cgit v1.2.3