Configure an "idle primary device reminder" interceptor
This commit is contained in:
		
							parent
							
								
									f7a3971c64
								
							
						
					
					
						commit
						8955e31a1e
					
				| 
						 | 
					@ -529,3 +529,6 @@ externalRequestFilter:
 | 
				
			||||||
    - /example
 | 
					    - /example
 | 
				
			||||||
  permittedInternalRanges:
 | 
					  permittedInternalRanges:
 | 
				
			||||||
    - 127.0.0.0/8
 | 
					    - 127.0.0.0/8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idlePrimaryDeviceReminder:
 | 
				
			||||||
 | 
					  minIdleDuration: P30D
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -37,6 +37,7 @@ import org.whispersystems.textsecuregcm.configuration.FcmConfiguration;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.GcpAttachmentsConfiguration;
 | 
					import org.whispersystems.textsecuregcm.configuration.GcpAttachmentsConfiguration;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.GenericZkConfig;
 | 
					import org.whispersystems.textsecuregcm.configuration.GenericZkConfig;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.GooglePlayBillingConfiguration;
 | 
					import org.whispersystems.textsecuregcm.configuration.GooglePlayBillingConfiguration;
 | 
				
			||||||
 | 
					import org.whispersystems.textsecuregcm.configuration.IdlePrimaryDeviceReminderConfiguration;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.KeyTransparencyServiceConfiguration;
 | 
					import org.whispersystems.textsecuregcm.configuration.KeyTransparencyServiceConfiguration;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.LinkDeviceSecretConfiguration;
 | 
					import org.whispersystems.textsecuregcm.configuration.LinkDeviceSecretConfiguration;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.configuration.MaxDeviceConfiguration;
 | 
					import org.whispersystems.textsecuregcm.configuration.MaxDeviceConfiguration;
 | 
				
			||||||
| 
						 | 
					@ -339,6 +340,10 @@ public class WhisperServerConfiguration extends Configuration {
 | 
				
			||||||
  @JsonProperty
 | 
					  @JsonProperty
 | 
				
			||||||
  private boolean logMessageDeliveryLoops;
 | 
					  private boolean logMessageDeliveryLoops;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  @JsonProperty
 | 
				
			||||||
 | 
					  private IdlePrimaryDeviceReminderConfiguration idlePrimaryDeviceReminder =
 | 
				
			||||||
 | 
					      new IdlePrimaryDeviceReminderConfiguration(Duration.ofDays(30));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  public TlsKeyStoreConfiguration getTlsKeyStoreConfiguration() {
 | 
					  public TlsKeyStoreConfiguration getTlsKeyStoreConfiguration() {
 | 
				
			||||||
    return tlsKeyStore;
 | 
					    return tlsKeyStore;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
| 
						 | 
					@ -566,4 +571,7 @@ public class WhisperServerConfiguration extends Configuration {
 | 
				
			||||||
    return logMessageDeliveryLoops;
 | 
					    return logMessageDeliveryLoops;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  public IdlePrimaryDeviceReminderConfiguration idlePrimaryDeviceReminderConfiguration() {
 | 
				
			||||||
 | 
					    return idlePrimaryDeviceReminder;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -82,6 +82,7 @@ import org.whispersystems.textsecuregcm.auth.CertificateGenerator;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.CloudflareTurnCredentialsManager;
 | 
					import org.whispersystems.textsecuregcm.auth.CloudflareTurnCredentialsManager;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
 | 
					import org.whispersystems.textsecuregcm.auth.DisconnectionRequestManager;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.ExternalServiceCredentialsGenerator;
 | 
					import org.whispersystems.textsecuregcm.auth.ExternalServiceCredentialsGenerator;
 | 
				
			||||||
 | 
					import org.whispersystems.textsecuregcm.auth.IdlePrimaryDeviceAuthenticatedWebSocketUpgradeFilter;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.PhoneVerificationTokenManager;
 | 
					import org.whispersystems.textsecuregcm.auth.PhoneVerificationTokenManager;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.RegistrationLockVerificationManager;
 | 
					import org.whispersystems.textsecuregcm.auth.RegistrationLockVerificationManager;
 | 
				
			||||||
import org.whispersystems.textsecuregcm.auth.TurnTokenGenerator;
 | 
					import org.whispersystems.textsecuregcm.auth.TurnTokenGenerator;
 | 
				
			||||||
| 
						 | 
					@ -980,6 +981,8 @@ public class WhisperServerService extends Application<WhisperServerConfiguration
 | 
				
			||||||
        config.getWebSocketConfiguration(), Duration.ofMillis(90000));
 | 
					        config.getWebSocketConfiguration(), Duration.ofMillis(90000));
 | 
				
			||||||
    webSocketEnvironment.jersey().register(new VirtualExecutorServiceProvider("managed-async-websocket-virtual-thread-"));
 | 
					    webSocketEnvironment.jersey().register(new VirtualExecutorServiceProvider("managed-async-websocket-virtual-thread-"));
 | 
				
			||||||
    webSocketEnvironment.setAuthenticator(new WebSocketAccountAuthenticator(accountAuthenticator, new AccountPrincipalSupplier(accountsManager)));
 | 
					    webSocketEnvironment.setAuthenticator(new WebSocketAccountAuthenticator(accountAuthenticator, new AccountPrincipalSupplier(accountsManager)));
 | 
				
			||||||
 | 
					    webSocketEnvironment.setAuthenticatedWebSocketUpgradeFilter(new IdlePrimaryDeviceAuthenticatedWebSocketUpgradeFilter(
 | 
				
			||||||
 | 
					        config.idlePrimaryDeviceReminderConfiguration().minIdleDuration(), Clock.systemUTC()));
 | 
				
			||||||
    webSocketEnvironment.setConnectListener(
 | 
					    webSocketEnvironment.setConnectListener(
 | 
				
			||||||
        new AuthenticatedConnectListener(receiptSender, messagesManager, messageMetrics, pushNotificationManager,
 | 
					        new AuthenticatedConnectListener(receiptSender, messagesManager, messageMetrics, pushNotificationManager,
 | 
				
			||||||
            pushNotificationScheduler, webSocketConnectionEventManager, websocketScheduledExecutor,
 | 
					            pushNotificationScheduler, webSocketConnectionEventManager, websocketScheduledExecutor,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -0,0 +1,11 @@
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Copyright 2025 Signal Messenger, LLC
 | 
				
			||||||
 | 
					 * SPDX-License-Identifier: AGPL-3.0-only
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					package org.whispersystems.textsecuregcm.configuration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import java.time.Duration;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public record IdlePrimaryDeviceReminderConfiguration(Duration minIdleDuration) {
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -508,3 +508,6 @@ externalRequestFilter:
 | 
				
			||||||
    - /example
 | 
					    - /example
 | 
				
			||||||
  permittedInternalRanges:
 | 
					  permittedInternalRanges:
 | 
				
			||||||
    - 127.0.0.0/8
 | 
					    - 127.0.0.0/8
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					idlePrimaryDeviceReminder:
 | 
				
			||||||
 | 
					  minIdleDuration: P30D
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue