pub struct OAuth2Config {
pub token_url: String,
pub client_id: String,
pub client_secret: String,
pub scope: String,
}Expand description
OAuth2 client_credentials configuration for automatic token exchange.
When configured on a route, the proxy handles the token lifecycle:
- Exchanges client_id + client_secret for an access_token at startup
- Caches the token with TTL from the
expires_inresponse - Refreshes automatically before expiry (30s buffer)
- Injects the access_token as
Authorization: Bearer <token>
The agent never sees client_id or client_secret — only a phantom token.
Fields§
§token_url: StringToken endpoint URL (e.g., “https://auth.example.com/oauth/token”)
client_id: StringClient ID — plain value or credential reference (env://, file://, op://)
client_secret: StringClient secret — credential reference (env://, file://, op://)
scope: StringOAuth2 scopes (space-separated). Empty = no scope parameter sent.
Trait Implementations§
Source§impl Clone for OAuth2Config
impl Clone for OAuth2Config
Source§fn clone(&self) -> OAuth2Config
fn clone(&self) -> OAuth2Config
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for OAuth2Config
impl Debug for OAuth2Config
Source§impl<'de> Deserialize<'de> for OAuth2Config
impl<'de> Deserialize<'de> for OAuth2Config
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for OAuth2Config
impl PartialEq for OAuth2Config
Source§impl Serialize for OAuth2Config
impl Serialize for OAuth2Config
impl StructuralPartialEq for OAuth2Config
Auto Trait Implementations§
impl Freeze for OAuth2Config
impl RefUnwindSafe for OAuth2Config
impl Send for OAuth2Config
impl Sync for OAuth2Config
impl Unpin for OAuth2Config
impl UnsafeUnpin for OAuth2Config
impl UnwindSafe for OAuth2Config
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more