1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! OAuth 2.0 `client_credentials` for outbound MCP and A2A routes (access
//! policy, phase 2).
//!
//! A route whose sidecar record says `auth_mode: "oauth_client_credentials"`
//! does not carry a static bearer. The admin seals the client id and secret as
//! one JSON secret, and the runner exchanges them for a short-lived access
//! token at the endpoint the sidecar names. [`TokenProvider`] does that
//! exchange and is shared by the MCP and A2A paths.
//!
//! What lives where:
//!
//! - the sidecar carries only non-secret parameters: `auth_mode`,
//! `oauth_endpoint`, `oauth_scope`, `oauth_audience` (field names must not
//! contain `secret`, `credential` or `token`; the designer ratchets that);
//! - the client id and secret travel only in the sealed secret, parsed by
//! [`ClientCredentials::from_secret_bytes`];
//! - the access token exists only inside [`TokenProvider`]'s cache and the
//! header of the request it authorises, always as a [`SecretString`].
//!
//! Failure policy: an unknown `auth_mode`, a malformed secret, or a JSON
//! client-credentials secret on a route that is not in OAuth mode all fail
//! THAT route with an explicit message. None of them ever falls back to
//! sending the stored value as a bearer.
pub use ;
pub use ;
/// The sidecar value that selects this flow.
pub const AUTH_MODE_OAUTH_CLIENT_CREDENTIALS: &str = "oauth_client_credentials";