aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/config
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2023-11-11 23:15:01 +0300
committerGravatar Vitaly Takmazov2023-11-11 23:15:01 +0300
commit816db24929732fa3967667ec76d95cbfb01068d1 (patch)
tree6a1686bb4161be22ff32765ec270236935d94dcd /src/main/java/com/juick/config
parent4d51f184da68cf8b70bdd406f0b90f3e758f1607 (diff)
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
Diffstat (limited to 'src/main/java/com/juick/config')
-rw-r--r--src/main/java/com/juick/config/HttpClientConfig.java2
-rw-r--r--src/main/java/com/juick/config/SecurityConfig.java5
2 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/juick/config/HttpClientConfig.java b/src/main/java/com/juick/config/HttpClientConfig.java
index 2540f4db..d838575d 100644
--- a/src/main/java/com/juick/config/HttpClientConfig.java
+++ b/src/main/java/com/juick/config/HttpClientConfig.java
@@ -28,7 +28,6 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import javax.inject.Inject;
-import java.util.concurrent.Executors;
@Configuration
public class HttpClientConfig {
@@ -38,7 +37,6 @@ public class HttpClientConfig {
@Bean
public OkHttpClient httpClient() {
return new OkHttpClient.Builder()
- .dispatcher(new Dispatcher(Executors.newFixedThreadPool(1)))
.addInterceptor(new HttpLoggingInterceptor(logger::debug)
.setLevel(HttpLoggingInterceptor.Level.BASIC))
.addInterceptor(new ActivityPubRequestInterceptor())
diff --git a/src/main/java/com/juick/config/SecurityConfig.java b/src/main/java/com/juick/config/SecurityConfig.java
index e02e32ed..c557ab4e 100644
--- a/src/main/java/com/juick/config/SecurityConfig.java
+++ b/src/main/java/com/juick/config/SecurityConfig.java
@@ -17,6 +17,7 @@
package com.juick.config;
+import com.juick.ActivityPubManager;
import com.juick.KeystoreManager;
import com.juick.service.ActivityPubService;
import com.juick.service.UserService;
@@ -105,7 +106,7 @@ public class SecurityConfig {
}
@Inject
- private ActivityPubService activityPubService;
+ private ActivityPubManager activityPubManager;
@Bean
HashParamAuthenticationFilter apiAuthenticationFilter() {
@@ -190,7 +191,7 @@ public class SecurityConfig {
SecurityFilterChain apiChain(HttpSecurity http) throws Exception {
http.securityMatcher("/api/**", "/u/**", "/n/**")
.addFilterBefore(apiAuthenticationFilter(), BasicAuthenticationFilter.class)
- .addFilterBefore(new HTTPSignatureAuthenticationFilter(activityPubService, userService),
+ .addFilterBefore(new HTTPSignatureAuthenticationFilter(activityPubManager, userService),
BasicAuthenticationFilter.class)
.authorizeHttpRequests(requests -> requests
.requestMatchers(HttpMethod.OPTIONS).permitAll()