pub struct OAuthConfig {
pub client_id: String,
pub client_secret: String,
pub issuer: String,
pub access_token_ttl_secs: Option<u64>,
pub refresh_token_ttl_secs: Option<u64>,
}Expand description
Pre-shared OAuth client credentials. Persisted at
<config_dir>/oauth.toml with mode 0600 so the secret never lands in a
world-readable location.
Fields§
§client_id: String§client_secret: String§issuer: StringPublic origin advertised in discovery + used to compute the resource metadata URL in 401 challenges. Must match what the client believes the canonical URI is (e.g. the Tailscale Funnel hostname).
access_token_ttl_secs: Option<u64>§refresh_token_ttl_secs: Option<u64>Implementations§
Source§impl OAuthConfig
impl OAuthConfig
pub fn effective_access_ttl(&self) -> Duration
pub fn effective_refresh_ttl(&self) -> Duration
Source§impl OAuthConfig
impl OAuthConfig
Sourcepub fn load_or_generate(issuer_hint: Option<String>) -> Result<Option<Self>>
pub fn load_or_generate(issuer_hint: Option<String>) -> Result<Option<Self>>
Resolve credentials. Precedence:
- If
<config_dir>/oauth.tomlexists, load it. - Otherwise, if
issuer_hintisSome, generate a fresh credential pair (random client_id + 32-byte hex client_secret), persist it with mode 0600, and return it. The generated values are logged to stderr so the user can paste them into the Claude.ai connector. - Otherwise, return
Ok(None)— OAuth is opt-in; without an issuer we cannot generate a sensible config.
Trait Implementations§
Source§impl Clone for OAuthConfig
impl Clone for OAuthConfig
Source§fn clone(&self) -> OAuthConfig
fn clone(&self) -> OAuthConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 OAuthConfig
impl Debug for OAuthConfig
Source§impl<'de> Deserialize<'de> for OAuthConfig
impl<'de> Deserialize<'de> for OAuthConfig
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
Auto Trait Implementations§
impl Freeze for OAuthConfig
impl RefUnwindSafe for OAuthConfig
impl Send for OAuthConfig
impl Sync for OAuthConfig
impl Unpin for OAuthConfig
impl UnsafeUnpin for OAuthConfig
impl UnwindSafe for OAuthConfig
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