Skip to content

Commit 133b399

Browse files
committed
feat!: Add apiKey support to API requests
- Introduced `apiKey` field for secure authentication in configuration and API requests. - Updated clear and task APIs to accept enhanced request objects. - Added required tests and assertions for `apiKey` handling across all request types. - Refactored HTTP operations to include `apiKey` in request headers. - Introduced new classes for managing authentication details. Fixes #187 Signed-off-by: Eric Deandrea <[email protected]>
1 parent 320e74b commit 133b399

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

docling-testcontainers/src/main/java/ai/docling/testcontainers/serve/config/DoclingServeContainerConfig.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
import java.time.Duration;
44
import java.util.Map;
55

6+
import org.jspecify.annotations.Nullable;
7+
68
/**
79
* A configuration interface for defining properties and settings related
810
* to the Docling container. This interface provides methods for retrieving
@@ -73,6 +75,7 @@ public interface DoclingServeContainerConfig {
7375
*
7476
* @return a {@code String} representing the API key.
7577
*/
78+
@Nullable
7679
String apiKey();
7780

7881
/**
@@ -146,6 +149,7 @@ class Builder {
146149
*
147150
* This field is protected and may be configured through the {@link Builder} class.
148151
*/
152+
@Nullable
149153
protected String apiKey;
150154

151155
/**

docs/src/doc/docs/testcontainers.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ DoclingServeContainerConfig config = DoclingServeContainerConfig.builder()
143143
))
144144
// Increase startup timeout if your CI is slow to pull images
145145
.startupTimeout(Duration.ofMinutes(2))
146+
// Set an optional api key for that consumers must specify
147+
.apiKey("my-secret-api-key")
146148
.build();
147149

148150
DoclingServeContainer container = new DoclingServeContainer(config);

0 commit comments

Comments
 (0)