pub trait OAuthEnvironment:
Send
+ Sync
+ 'static {
type Token: TokenEndpoint + Send + Sync;
// Required methods
fn token_endpoint(&self, url: &str) -> Self::Token;
fn get(
&self,
url: &str,
) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send;
fn post_json(
&self,
url: &str,
body: &str,
) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send;
fn authorize(
&self,
authorization_url: &str,
) -> impl Future<Output = Result<AuthorizationCallback, EnvironmentError>> + Send;
}Expand description
The outside world, as the authorization flow sees it.
Required Associated Types§
Sourcetype Token: TokenEndpoint + Send + Sync
type Token: TokenEndpoint + Send + Sync
Where authorization codes are redeemed, bound to one endpoint.
Required Methods§
Sourcefn token_endpoint(&self, url: &str) -> Self::Token
fn token_endpoint(&self, url: &str) -> Self::Token
A token endpoint at url.
Sourcefn get(
&self,
url: &str,
) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send
fn get( &self, url: &str, ) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send
GETs url without following redirects.
§Errors
EnvironmentError::Unavailable when no response was read.
Sourcefn post_json(
&self,
url: &str,
body: &str,
) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send
fn post_json( &self, url: &str, body: &str, ) -> impl Future<Output = Result<Fetched, EnvironmentError>> + Send
POSTs body to url as application/json.
§Errors
EnvironmentError::Unavailable when no response was read.
Sends the user to authorization_url and returns where they came back.
A browser adapter opens the URL and waits for the loopback redirect; a
headless one asks an authorization server that approves by itself and
reads the Location it answers with.
§Errors
EnvironmentError::Declined when no callback arrived.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".