pub trait OidcHttpClient {
// Required method
fn request(
&self,
req: HttpRequest,
) -> impl Future<Output = Result<HttpResponse, String>> + Send;
// Provided method
fn get_client_certificate(
&self,
_req: &HttpRequest,
) -> impl Future<Output = Option<ClientCertificate>> + Send { ... }
}Expand description
This trait defines the interface for making HTTP requests used by the OpenID library. Users who need custom HTTP clients need to implement this trait.
Required Methods§
Sourcefn request(
&self,
req: HttpRequest,
) -> impl Future<Output = Result<HttpResponse, String>> + Send
fn request( &self, req: HttpRequest, ) -> impl Future<Output = Result<HttpResponse, String>> + Send
Makes an HTTP request using the provided HttpRequest object.
This function takes an HttpRequest object as input and returns a future
implementing std::future::Future<Output = Result<HttpResponse, String>>.
The future resolves to either a Result<HttpResponse, String>.
- On success, the result is
Ok(HttpResponse)containing the HTTP response. - On error, the result is
Err(String)with an error message describing the failure.
This function allows the library to be agnostic to the specific HTTP client implementation used, as long as it implements this trait.
Provided Methods§
Sourcefn get_client_certificate(
&self,
_req: &HttpRequest,
) -> impl Future<Output = Option<ClientCertificate>> + Send
fn get_client_certificate( &self, _req: &HttpRequest, ) -> impl Future<Output = Option<ClientCertificate>> + Send
Gets the client certificate for the current request. Return none if the request does not need mtls
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.