Package io.floci.testcontainers.config
Class SecurityConfig
java.lang.Object
io.floci.testcontainers.config.SecurityConfig
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();
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidapplyEnvVarsToContainer(org.testcontainers.containers.Container<?> container) Applies this security configuration to the given container by setting the appropriate environment variables.static SecurityConfig.Builderbuilder()Returns a newSecurityConfig.Builderfor this configuration.Returns the extra CORS allowed headers, orOptional.empty()if not configured.Returns the extra CORS allowed origins, orOptional.empty()if not configured.Returns the extra CORS expose headers, orOptional.empty()if not configured.booleanReturns whether Private Network Access preflights are granted (responds withAccess-Control-Allow-Private-Network: true) once the origin already passes the CORS allow-list.booleanReturns whether CORS headers are disabled.Returns a newSecurityConfig.Builderfor this configuration, initialized with the current values of this instance.
-
Method Details
-
builder
Returns a newSecurityConfig.Builderfor this configuration.- Returns:
- a new builder
-
toBuilder
Returns a newSecurityConfig.Builderfor this configuration, initialized with the current values of this instance.- Returns:
- a new builder pre-populated with this configuration's values
-
getExtraCorsAllowedOrigins
Returns the extra CORS allowed origins, orOptional.empty()if not configured.- Returns:
- the extra CORS allowed origins, or
Optional.empty()
-
getExtraCorsAllowedHeaders
Returns the extra CORS allowed headers, orOptional.empty()if not configured.- Returns:
- the extra CORS allowed headers, or
Optional.empty()
-
getExtraCorsExposeHeaders
Returns the extra CORS expose headers, orOptional.empty()if not configured.- Returns:
- the extra CORS expose headers, or
Optional.empty()
-
isDisableCorsHeaders
public boolean isDisableCorsHeaders()Returns whether CORS headers are disabled.- Returns:
trueif CORS headers are disabled
-
isCorsAllowPrivateNetwork
public boolean isCorsAllowPrivateNetwork()Returns whether Private Network Access preflights are granted (responds withAccess-Control-Allow-Private-Network: true) once the origin already passes the CORS allow-list.- Returns:
trueif 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
-