#[non_exhaustive]pub struct TokenExchangeConfig {
pub token_url: String,
pub client_id: String,
pub client_secret: Option<SecretString>,
pub client_cert: Option<ClientCertConfig>,
pub audience: String,
}Expand description
Configuration for RFC 8693 token exchange.
The MCP server uses this to exchange an inbound user access token (audience = MCP server) for a downstream access token (audience = the upstream API the application calls) via the authorization server’s token endpoint.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.token_url: StringAuthorization server token endpoint used for the exchange
(e.g. https://keycloak.example.com/realms/myrealm/protocol/openid-connect/token).
client_id: StringOAuth client_id of the MCP server (the requester).
client_secret: Option<SecretString>OAuth client_secret for confidential-client authentication.
Omit when using client_cert (mTLS) instead.
client_cert: Option<ClientCertConfig>Client certificate for mTLS-based client authentication. When set, the exchange request authenticates with a TLS client certificate instead of a shared secret.
audience: StringTarget audience - the client_id of the downstream API
(e.g. upstream-api). The exchanged token will have this
value in its aud claim.
Implementations§
Source§impl TokenExchangeConfig
impl TokenExchangeConfig
Sourcepub fn new(
token_url: String,
client_id: String,
client_secret: Option<SecretString>,
client_cert: Option<ClientCertConfig>,
audience: String,
) -> Self
pub fn new( token_url: String, client_id: String, client_secret: Option<SecretString>, client_cert: Option<ClientCertConfig>, audience: String, ) -> Self
Create a new token exchange configuration.
Trait Implementations§
Source§impl Clone for TokenExchangeConfig
impl Clone for TokenExchangeConfig
Source§fn clone(&self) -> TokenExchangeConfig
fn clone(&self) -> TokenExchangeConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more