Trait AuthProvider
pub trait AuthProvider:
Clone
+ Send
+ Sync
+ 'static {
type Error: Into<CratestackError> + Send;
// Required method
fn authenticate(
&self,
request: &RequestContext<'_>,
) -> impl Future<Output = Result<CratestackContext, Self::Error>> + Send;
}Expand description
Resolves the caller of a request into a CratestackContext.
Implement authenticate as a plain async fn returning
Result<CratestackContext, Self::Error> — the impl Future + Send
return type below is only how the trait spells “the future must be
Send”, and an async fn in the impl satisfies it directly. For the
synchronous, header-only case a Clone + Send + Sync closure
Fn(&http::HeaderMap) -> Result<CratestackContext, E> already
implements this trait (see the blanket impl below).
Required Associated Types§
type Error: Into<CratestackError> + Send
Required Methods§
fn authenticate( &self, request: &RequestContext<'_>, ) -> impl Future<Output = Result<CratestackContext, Self::Error>> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".