[][src]Trait bellhop::auth::Auth

pub trait Auth: Debug {
    fn authenticate(
        &self,
        _conn: &Db,
        _req: &Request
    ) -> Result<Option<User>, Error>; fn prelaunch(&self, rocket: Rocket) -> Rocket { ... } }

Trait for plugins that provide authentication.

See module documentation for more information.

Required methods

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.

Loading content...

Provided methods

fn prelaunch(&self, rocket: Rocket) -> Rocket

Perform Rocket related setup, like attaching routes and fairings, reading configuration values, etc.

Loading content...

Implementors

Loading content...