pub trait AuthProvider: Send + Sync {
// Required method
fn bearer_token<'a>(&'a self, authority: &'a str) -> AuthFuture<'a>;
// Provided method
fn token_rejected(&self, authority: &str) { ... }
}Expand description
Supplies read credentials per registry authority (RFC-ACDP-0008 §6.2).
Implement this to plug in a token source that refreshes before exp
(registries SHOULD keep bearer_jwt lifetimes short). Return
Ok(None) for an authority you hold no credential for: the read goes
out anonymously. An Err aborts the read and is returned to the caller
unchanged; during revocation discovery it becomes unknown with the
reason its error class maps to.
Required Methods§
Sourcefn bearer_token<'a>(&'a self, authority: &'a str) -> AuthFuture<'a>
fn bearer_token<'a>(&'a self, authority: &'a str) -> AuthFuture<'a>
The token to present to authority (host, plus port when
non-default — the same value as
RegistryClient::authority).
Provided Methods§
Sourcefn token_rejected(&self, authority: &str)
fn token_rejected(&self, authority: &str)
Called when authority answered a read that carried this
provider’s token with HTTP 401 or 403 — the token may have expired
or been revoked. Drop any cached token for authority here so the
next read fetches a fresh one. The rejected read itself is not
retried. Default: no-op.
Trait Implementations§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".