pub trait BearerAuth: Send + Sync {
// Required methods
fn bearer(&self) -> Option<String>;
fn challenged<'a>(
&'a self,
status: u16,
www_authenticate: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<(), BearerError>> + Send + 'a>>;
fn accepted(&self);
}Expand description
A token to send, and a way to get another.
Required Methods§
Sourcefn bearer(&self) -> Option<String>
fn bearer(&self) -> Option<String>
The token to send in Authorization: Bearer …, if there is one.
Sourcefn challenged<'a>(
&'a self,
status: u16,
www_authenticate: Option<&'a str>,
) -> Pin<Box<dyn Future<Output = Result<(), BearerError>> + Send + 'a>>
fn challenged<'a>( &'a self, status: u16, www_authenticate: Option<&'a str>, ) -> Pin<Box<dyn Future<Output = Result<(), BearerError>> + Send + 'a>>
The server answered status (401 or 403) with www_authenticate.
Ok means a new token is in place and the request should be retried;
Err means it should not be.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".