Class SecurityConfig

java.lang.Object
io.floci.testcontainers.config.SecurityConfig

public class SecurityConfig extends Object
Security-related configuration for the Floci server.

Instances are created via SecurityConfig.Builder:


 SecurityConfig config = SecurityConfig.builder()
     .extraCorsAllowedOrigins(List.of("https://example.com"))
     .disableCorsHeaders(true)
     .build();
 
  • Method Details

    • builder

      public static SecurityConfig.Builder builder()
      Returns a new SecurityConfig.Builder for this configuration.
      Returns:
      a new builder
    • toBuilder

      public SecurityConfig.Builder toBuilder()
      Returns a new SecurityConfig.Builder for this configuration, initialized with the current values of this instance.
      Returns:
      a new builder pre-populated with this configuration's values
    • getExtraCorsAllowedOrigins

      public Optional<List<String>> getExtraCorsAllowedOrigins()
      Returns the extra CORS allowed origins, or Optional.empty() if not configured.
      Returns:
      the extra CORS allowed origins, or Optional.empty()
    • getExtraCorsAllowedHeaders

      public Optional<List<String>> getExtraCorsAllowedHeaders()
      Returns the extra CORS allowed headers, or Optional.empty() if not configured.
      Returns:
      the extra CORS allowed headers, or Optional.empty()
    • getExtraCorsExposeHeaders

      public Optional<List<String>> getExtraCorsExposeHeaders()
      Returns the extra CORS expose headers, or Optional.empty() if not configured.
      Returns:
      the extra CORS expose headers, or Optional.empty()
    • isDisableCorsHeaders

      public boolean isDisableCorsHeaders()
      Returns whether CORS headers are disabled.
      Returns:
      true if CORS headers are disabled
    • isCorsAllowPrivateNetwork

      public boolean isCorsAllowPrivateNetwork()
      Returns whether Private Network Access preflights are granted (responds with Access-Control-Allow-Private-Network: true) once the origin already passes the CORS allow-list.
      Returns:
      true if Private Network Access preflights are granted
    • applyEnvVarsToContainer

      public void applyEnvVarsToContainer(org.testcontainers.containers.Container<?> container)
      Applies this security configuration to the given container by setting the appropriate environment variables.
      Parameters:
      container - the container to configure