pub struct AuthConfig {
pub remote_endpoint: Option<String>,
pub machine_token: Option<String>,
pub accounts: BTreeMap<String, String>,
pub auto: BTreeMap<String, String>,
}Expand description
Auth configuration parsed from auth.* keys. Controls whether this client
resolves provider tokens from the local auth.json (default) or from a
remote credential broker. See task #157 / auth::credential_source.
Fields§
§remote_endpoint: Option<String>Broker base URL. When set (here, or via SYNAPS_AUTH_ENDPOINT), the
client fetches short-lived access tokens from the broker instead of
reading/refreshing the local auth.json.
machine_token: Option<String>Per-machine bearer presented to the broker (or SYNAPS_MACHINE_TOKEN).
This is the machine’s own identity, never the provider credential.
accounts: BTreeMap<String, String>Selected OAuth account per provider from auth.account.<provider> = <label|default|auto>. Keys are the raw provider ids as written;
validation (and fail-closed handling of bad labels) happens in
AccountPolicy::from_config_map.
auto: BTreeMap<String, String>Raw automatic chooser settings, relative to auth.auto.
Implementations§
Source§impl AuthConfig
impl AuthConfig
Sourcepub fn account_policy(&self) -> AccountPolicy
pub fn account_policy(&self) -> AccountPolicy
Account policy from config only (no env overlay). Invalid entries fail
closed for their provider; see AccountPolicy::from_config_map.
Sourcepub fn account_selector(&self, provider: OAuthProviderId) -> AccountSelector
pub fn account_selector(&self, provider: OAuthProviderId) -> AccountSelector
Effective selector for one provider (env > config > default).
Sourcepub fn credential_source(&self) -> CredentialSource
pub fn credential_source(&self) -> CredentialSource
Resolve the credential source. Environment variables take precedence over
config-file values: SYNAPS_AUTH_ENDPOINT / SYNAPS_MACHINE_TOKEN.
Returns Remote iff an endpoint is set (env or config), else Local.
The machine token here is only ever the EXPLICIT one (env or config).
When none is configured it stays empty, and that emptiness is the
provenance record: the broker client (crate::core::auth::MachineToken)
then uses — and may re-read after a 401 — the local broker’s
auto-generated <base_dir>/auth-broker.token, but only for a loopback
endpoint (#147 C1, prA N1). An explicit token is never replaced by,
or sent alongside, the file token.
Trait Implementations§
Source§impl Clone for AuthConfig
impl Clone for AuthConfig
Source§fn clone(&self) -> AuthConfig
fn clone(&self) -> AuthConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AuthConfig
impl Debug for AuthConfig
Source§impl Default for AuthConfig
impl Default for AuthConfig
Source§fn default() -> AuthConfig
fn default() -> AuthConfig
Auto Trait Implementations§
impl Freeze for AuthConfig
impl RefUnwindSafe for AuthConfig
impl Send for AuthConfig
impl Sync for AuthConfig
impl Unpin for AuthConfig
impl UnsafeUnpin for AuthConfig
impl UnwindSafe for AuthConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more