Class SecurityConfig.Builder

java.lang.Object
io.floci.testcontainers.config.SecurityConfig.Builder
Enclosing class:
SecurityConfig

public static class SecurityConfig.Builder extends Object
Builder for SecurityConfig.
  • Method Details

    • extraCorsAllowedOrigins

      public SecurityConfig.Builder extraCorsAllowedOrigins(List<String> extraCorsAllowedOrigins)
      Sets the extra CORS allowed origins.
      Parameters:
      extraCorsAllowedOrigins - the list of allowed origins, or null to clear
      Returns:
      this builder
    • extraCorsAllowedOrigins

      public SecurityConfig.Builder extraCorsAllowedOrigins(String... extraCorsAllowedOrigins)
      Sets the extra CORS allowed origins.
      Parameters:
      extraCorsAllowedOrigins - the allowed origins
      Returns:
      this builder
    • extraCorsAllowedHeaders

      public SecurityConfig.Builder extraCorsAllowedHeaders(List<String> extraCorsAllowedHeaders)
      Sets the extra CORS allowed headers.
      Parameters:
      extraCorsAllowedHeaders - the list of allowed headers, or null to clear
      Returns:
      this builder
    • extraCorsAllowedHeaders

      public SecurityConfig.Builder extraCorsAllowedHeaders(String... extraCorsAllowedHeaders)
      Sets the extra CORS allowed headers.
      Parameters:
      extraCorsAllowedHeaders - the allowed headers
      Returns:
      this builder
    • extraCorsExposeHeaders

      public SecurityConfig.Builder extraCorsExposeHeaders(List<String> extraCorsExposeHeaders)
      Sets the extra CORS expose headers.
      Parameters:
      extraCorsExposeHeaders - the list of expose headers, or null to clear
      Returns:
      this builder
    • extraCorsExposeHeaders

      public SecurityConfig.Builder extraCorsExposeHeaders(String... extraCorsExposeHeaders)
      Sets the extra CORS expose headers.
      Parameters:
      extraCorsExposeHeaders - the expose headers
      Returns:
      this builder
    • disableCorsHeaders

      public SecurityConfig.Builder disableCorsHeaders(boolean disableCorsHeaders)
      Sets whether CORS headers are disabled.
      Parameters:
      disableCorsHeaders - true to disable CORS headers (default false)
      Returns:
      this builder
    • corsAllowPrivateNetwork

      public SecurityConfig.Builder corsAllowPrivateNetwork(boolean corsAllowPrivateNetwork)
      Sets whether to grant Private Network Access preflights (respond with Access-Control-Allow-Private-Network: true) when the browser asks. Only takes effect after the origin already passes the CORS allow-list, so a page served from a public/secure origin can reach this loopback backend.

      Off by default: it lets a public origin reach the private network, so it must be opted into explicitly.

      Parameters:
      corsAllowPrivateNetwork - true to grant Private Network Access preflights (default false)
      Returns:
      this builder
    • build

      public SecurityConfig build()
      Creates an immutable SecurityConfig from this builder.
      Returns:
      the security configuration