pub trait Auth: Debug {
fn authenticate(
&self,
_conn: &Db<'_>,
_req: &Request<'_>
) -> Result<Option<User>, Error>;
fn prelaunch(&self, rocket: Rocket) -> Rocket { ... }
}
Expand description
Trait for plugins that provide authentication.
See module documentation for more information.
Required Methods§
sourcefn authenticate(
&self,
_conn: &Db<'_>,
_req: &Request<'_>
) -> Result<Option<User>, Error>
fn authenticate(
&self,
_conn: &Db<'_>,
_req: &Request<'_>
) -> Result<Option<User>, Error>
Return the [models::user::User
] that is authenticated in the given
Request
.
A return value of Ok(None)
means that there is no authenticated user
according to this plugin. Authentication will be retried with the next
plugin.
On the other hand, a return value of Err(...)
will abort the process,
and no user authentication will be retried.