pub trait AuthInstance:
Clone
+ Send
+ Sync
+ 'static {
type Db: Adapter;
type UserFields: Fields;
type Plugins: PluginSet;
// Required methods
fn config(&self) -> &CoreConfig;
fn api(&self) -> Api<'_, Self::Db>;
fn try_plugin<P: Plugin>(&self) -> Option<&P>;
fn handle(
&self,
request: Request<Bytes>,
) -> impl Future<Output = Response> + Send;
fn session_with_cookies(
&self,
headers: &HeaderMap,
) -> impl Future<Output = (Result<Option<SessionData<Self::UserFields, Self::Plugins>>, AuthError>, Vec<HeaderValue>)> + Send;
}Expand description
What integrations and plugin extension traits need from an auth instance, without naming its type parameters.
Required Associated Types§
Required Methods§
fn config(&self) -> &CoreConfig
fn api(&self) -> Api<'_, Self::Db>
Sourcefn try_plugin<P: Plugin>(&self) -> Option<&P>
fn try_plugin<P: Plugin>(&self) -> Option<&P>
A registered plugin’s config, or None when P isn’t registered. For code generic
over AuthInstance (an axum extractor) that can’t name the HasPlugin index; with a
concrete Auth, a plugin’s extension trait is the compile-checked way.
fn handle( &self, request: Request<Bytes>, ) -> impl Future<Output = Response> + Send
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".