pub struct RevocationClient { /* private fields */ }Expand description
An async OAuth 2.0 token revocation client (RFC 7009).
Construct one with RevocationClient::builder. A single client should be
reused across calls so the underlying connection pool is shared.
Implementations§
Source§impl RevocationClient
impl RevocationClient
Sourcepub fn builder() -> RevocationClientBuilder
pub fn builder() -> RevocationClientBuilder
Returns a builder for configuring a RevocationClient.
Sourcepub async fn revoke(
&self,
token: &str,
token_type_hint: Option<&str>,
) -> Result<()>
pub async fn revoke( &self, token: &str, token_type_hint: Option<&str>, ) -> Result<()>
Revokes a token (RFC 7009 §2.1, REV-001).
POSTs token to the revocation endpoint as
application/x-www-form-urlencoded and authenticates the client.
token_type_hint is the optional token_type_hint parameter, typically
"access_token" or "refresh_token" (REV-002). The server MAY use it
to optimise lookup but MUST still accept the request if it is wrong, so
an incorrect hint is not an error. Pass None (or an empty string) to
omit it.
§Success says nothing about the token
Any HTTP 200 yields Ok(()), whether the body is empty or an empty JSON
object, and regardless of whether the token was valid, expired, already
revoked, or unknown (RFC 7009 §2.2). Treating Ok(()) as proof the token
existed would reintroduce exactly the token-scanning oracle the RFC
closes.
§Errors
IdentityError::TokenEndpoint— a non-2xx OAuth error response, such as HTTP 400unsupported_token_type(REV-003) or HTTP 401invalid_client(REV-004).IdentityError::Http— a transport failure or a non-OAuth error body.IdentityError::Configuration— a non-https endpoint withoutallow_http.