#[non_exhaustive]pub enum Auth {
ApiKey(String),
Token(String),
Provider(Arc<dyn TokenProvider>),
}Expand description
Static credentials supplied to the client.
Ably accepts HTTP Basic auth with an API key (keyName:keySecret) or
Bearer auth with an Ably Token/JWT. Auth::Provider refreshes on
demand via a caller-supplied TokenProvider (ADR-0005).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
ApiKey(String)
An Ably API key, keyName:keySecret, sent as HTTP Basic.
Token(String)
An Ably Token/JWT, sent as a Bearer token.
Provider(Arc<dyn TokenProvider>)
A caller-supplied provider that yields (and refreshes) Bearer credentials.
Implementations§
Source§impl Auth
impl Auth
Sourcepub fn api_key(key: impl Into<String>) -> Self
pub fn api_key(key: impl Into<String>) -> Self
Constructs API-key (HTTP Basic) credentials from a keyName:keySecret.
Sourcepub fn token(token: impl Into<String>) -> Self
pub fn token(token: impl Into<String>) -> Self
Constructs Bearer-token credentials from an Ably Token/JWT.
Sourcepub fn provider(p: Arc<dyn TokenProvider>) -> Self
pub fn provider(p: Arc<dyn TokenProvider>) -> Self
Constructs credentials backed by a refreshing TokenProvider.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Auth
impl !UnwindSafe for Auth
impl Freeze for Auth
impl Send for Auth
impl Sync for Auth
impl Unpin for Auth
impl UnsafeUnpin for Auth
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