pub struct MachineToken { /* private fields */ }Expand description
The machine token a client presents to a broker, with its provenance.
- Explicit (
auth.machine_token/SYNAPS_MACHINE_TOKEN, i.e. a non-empty configured token): fixed. Never replaced by, and never sent alongside, the local file token (prA N1) — even on a loopback endpoint, which may be anssh -Ltunnel to a remote broker. - None configured + loopback endpoint: the local broker’s
<base_dir>/auth-broker.token, read now and re-read after a 401 (prA I2), so a long-lived client started before the broker’s first run, or across a rotation, recovers without a restart. - None configured + remote endpoint: empty, never reads the file.
Clones share the current value.
Implementations§
Source§impl MachineToken
impl MachineToken
Sourcepub fn for_endpoint(endpoint: &str, token: impl Into<String>) -> Self
pub fn for_endpoint(endpoint: &str, token: impl Into<String>) -> Self
token is the EXPLICITLY configured token (“” = none configured).
Sourcepub fn is_from_local_file(&self) -> bool
pub fn is_from_local_file(&self) -> bool
Whether this token comes from the local broker token file.
pub fn get(&self) -> String
After a 401: re-read the local broker token file. Returns true when a different non-empty token was found (and is now current).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MachineToken
impl RefUnwindSafe for MachineToken
impl Send for MachineToken
impl Sync for MachineToken
impl Unpin for MachineToken
impl UnsafeUnpin for MachineToken
impl UnwindSafe for MachineToken
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