You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 3eec065
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/client/transport/jsonrpc/JSONRPCTransportConfigBuilder.java
Copy file name to clipboardExpand all lines: client/transport/jsonrpc/src/main/java/org/a2aproject/sdk/client/transport/jsonrpc/JSONRPCTransportProvider.java
Copy file name to clipboardExpand all lines: client/transport/rest/src/main/java/org/a2aproject/sdk/client/transport/rest/RestTransportConfigBuilder.java
Copy file name to clipboardExpand all lines: docs/content/dev/extra/http-clients.md
+50-5Lines changed: 50 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,11 +55,15 @@ For non-Quarkus environments, also add `vertx-web-client`:
55
55
56
56
The `VertxA2AHttpClientProvider` has **priority 100**. The SDK's `A2AHttpClientFactory` discovers all registered providers via `ServiceLoader`, sorts them by descending priority, and tries each in order, falling back to the next one on failure.
57
57
58
-
To force a specific provider by name (useful in tests), use `A2AHttpClientFactory.create(String providerName)`:
58
+
Use `A2AHttpClientFactory.create(A2AHttpClientConfiguration)` for both the default client and
59
+
custom provider selection. To force the JDK provider, exclude the other built-in providers:
59
60
60
61
```java
61
62
// Force the JDK client regardless of what else is on the classpath
Copy file name to clipboardExpand all lines: docs/content/dev/security.md
+33-10Lines changed: 33 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -43,35 +43,58 @@ Additionally, API keys are only injected when the security scheme explicitly spe
43
43
44
44
## HTTP Redirect Handling
45
45
46
-
SDK-managed HTTP clients do not follow redirects automatically by default. This prevents credentials from being inadvertently forwarded to third-party origins during redirect chains.
46
+
SDK-managed HTTP clients do not follow redirects automatically by default. When explicitly enabled
47
+
on a synchronous POST builder with `followRedirects(true)`, they follow at most one HTTP(S)
48
+
redirect and apply the shared `RedirectHeaderPolicy`. JDK and Vert.x clients follow cross-origin
49
+
301, 302, and 303 redirects as GET requests with only the default safe headers, including
50
+
`A2A-Version` and `A2A-Extensions`, unless additional headers are configured for that exact target
51
+
origin. No client follows a cross-origin 307 or 308 redirect, so the original POST body is never
52
+
forwarded to another origin. HTTPS-to-HTTP redirects are not followed; the client returns the
53
+
original redirect response. Redirect following does not apply to
54
+
`postAsyncSSE()`.
47
55
48
56
### JDK HTTP Client
49
57
50
-
The default `JdkA2AHttpClient` is configured with `HttpClient.Redirect.NEVER`. If your application requires redirect following, provide a custom `HttpClient` instance:
58
+
The default `JdkA2AHttpClient` uses `HttpClient.Redirect.NEVER`. Native JDK redirect following
59
+
must remain disabled so the SDK can apply its redirect policy. Enable the SDK-managed one-hop
60
+
redirect on an individual synchronous `post()` request:
When supplying your own `HttpClient`, configure `HttpClient.Redirect.NEVER` before using
72
+
`followRedirects(true)`. The SDK rejects native redirect policies for that request with an
73
+
`IOException`; native handling would bypass the SDK redirect policy.
74
+
60
75
### Vert.x HTTP Client
61
76
62
-
The default `VertxA2AHttpClient` is configured with `setFollowRedirects(false)`. If redirect following is needed, create a custom `WebClient` with the desired policy and pass the underlying `Vertx` instance to the constructor.
77
+
The default `VertxA2AHttpClient` is configured with `setFollowRedirects(false)`. Use
78
+
`followRedirects(true)` on a synchronous `post()` builder to enable the same SDK-managed one-hop
79
+
redirect policy. `postAsyncSSE()` does not follow redirects.
63
80
64
81
### Android HTTP Client
65
82
66
-
The `AndroidA2AHttpClient` disables automatic redirect following by calling `setInstanceFollowRedirects(false)` on all `HttpURLConnection` instances. Applications requiring redirect handling must implement it manually.
83
+
The `AndroidA2AHttpClient` disables automatic redirect following by calling
84
+
`setInstanceFollowRedirects(false)` on all `HttpURLConnection` instances. Use
85
+
`followRedirects(true)` on a synchronous `post()` builder to enable same-origin one-hop
86
+
redirects. Android always returns the original redirect response for a cross-origin target:
87
+
`HttpURLConnection` cannot isolate process-wide `CookieHandler` or `Authenticator` state for an
88
+
individual follow-up request, and those globals can change concurrently.
89
+
`postAsyncSSE()` does not follow redirects.
67
90
68
91
## Best Practices
69
92
70
93
1.**Use Standard Authentication Headers**: When implementing custom agents, use standard authentication header names from the safe allowlist to ensure credentials are properly injected.
71
94
72
95
2.**Validate Agent Cards**: Before connecting to an agent, review its security schemes to ensure they use appropriate authentication methods and header names.
73
96
74
-
3.**Handle Redirects Carefully**: If your application requires redirect following, implement it with caution and ensure credentials are not forwarded to untrusted origins.
97
+
3.**Handle Redirects Carefully**: Enable SDK-managed redirects only when needed. A custom `RedirectHeaderPolicy` requires explicit trusted target origins before forwarding additional headers; use HTTPS origins for credentials.
75
98
76
99
4.**Keep Dependencies Updated**: Regularly update the SDK and its dependencies to receive the latest security patches.
0 commit comments