pub struct Auth<D, U = (), P = Nil> { /* private fields */ }Expand description
A configured auth instance. Cheap to clone (two Arcs).
D is the database adapter, U the app’s user fields, P the plugin list
(plugins![TwoFactor, Organization]).
Implementations§
Source§impl<D: Adapter, U: Fields, P: PluginSet> Auth<D, U, P>
impl<D: Adapter, U: Fields, P: PluginSet> Auth<D, U, P>
pub fn config(&self) -> &CoreConfig
pub fn schema(&self) -> &Schema
pub fn adapter(&self) -> &D
pub fn migrator(&self) -> Migrator<'_, D>
Sourcepub fn plugin<Pl: Plugin, I>(&self) -> &Plwhere
P: Has<Pl, I>,
pub fn plugin<Pl: Plugin, I>(&self) -> &Plwhere
P: Has<Pl, I>,
A registered plugin’s config. Doesn’t compile when the plugin isn’t registered.
Sourcepub async fn handle(&self, request: Request<Bytes>) -> Response
pub async fn handle(&self, request: Request<Bytes>) -> Response
Handles a request under base_path. Integrations call this.
The session for these request headers, plus Set-Cookie values the caller should
add to its response (refreshed or cleared cookies).
Sourcepub async fn get_session(
&self,
headers: &HeaderMap,
) -> Result<Option<SessionData<U, P>>, AuthError>
pub async fn get_session( &self, headers: &HeaderMap, ) -> Result<Option<SessionData<U, P>>, AuthError>
The session for these request headers (cookie, or any registered resolver).
Sourcepub async fn get_session_by_token(
&self,
token: &str,
) -> Result<Option<SessionData<U, P>>, AuthError>
pub async fn get_session_by_token( &self, token: &str, ) -> Result<Option<SessionData<U, P>>, AuthError>
The session for a raw token, e.g. from a WebSocket query string.
Trait Implementations§
Auto Trait Implementations§
impl<D, U = (), P = Nil> !RefUnwindSafe for Auth<D, U, P>
impl<D, U = (), P = Nil> !UnwindSafe for Auth<D, U, P>
impl<D, U, P> Forget for Auth<D, U, P>
impl<D, U, P> Freeze for Auth<D, U, P>
impl<D, U, P> Move for Auth<D, U, P>
impl<D, U, P> Send for Auth<D, U, P>
impl<D, U, P> Sync for Auth<D, U, P>
impl<D, U, P> Unpin for Auth<D, U, P>
impl<D, U, P> UnsafeUnpin for Auth<D, U, P>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more