Skip to main content

BearerAuth

Trait BearerAuth 

Source
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§

Source

fn bearer(&self) -> Option<String>

The token to send in Authorization: Bearer …, if there is one.

Source

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.

Source

fn accepted(&self)

The last request was accepted, so the count of refusals starts over.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§