pub trait OnChallenge:
Debug
+ Send
+ Sync {
// Required method
fn on_challenge<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 Context<'_>,
request: &'life2 mut Request,
authorizer: &'life3 dyn Authorizer,
headers: &'life4 Headers,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait;
}Expand description
Callback BearerTokenAuthorizationPolicy invokes when it receives a 401 Unauthorized response with an authentication challenge (WWW-Authenticate header).
Required Methods§
Sourcefn on_challenge<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 Context<'_>,
request: &'life2 mut Request,
authorizer: &'life3 dyn Authorizer,
headers: &'life4 Headers,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
fn on_challenge<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
&'life0 self,
context: &'life1 Context<'_>,
request: &'life2 mut Request,
authorizer: &'life3 dyn Authorizer,
headers: &'life4 Headers,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
Called when BearerTokenAuthorizationPolicy receives a 401 Unauthorized response with a challenge.
Implementations are responsible for parsing authentication parameters from the challenge, authorizing the request via the provided Authorizer,
and indicating whether the policy should retry the request.
§Arguments
context- The request contextrequest- The HTTP request that received the challengeauthorizer- Helper used to acquire an access token and set the request’s authorization headerheaders- The 401 response’s headers
§Returns
Okwhen the callback handled the challenge andBearerTokenAuthorizationPolicyshould retry the request.Errwhen an error occurred while handling the challenge.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".