Skip to main content

AccountSession

Trait AccountSession 

Source
pub trait AccountSession {
    type Account: AccountAuthorizer;

    // Required method
    fn authorize(
        &self,
        required_role: <Self::Account as AccountAuthorizer>::Role,
    ) -> Result<&Self::Account, <Self::Account as AccountAuthorizer>::Error>;
}
Expand description

Session capability used by protected handlers.

Required Associated Types§

Source

type Account: AccountAuthorizer

Account loaded by the session.

Required Methods§

Source

fn authorize( &self, required_role: <Self::Account as AccountAuthorizer>::Role, ) -> Result<&Self::Account, <Self::Account as AccountAuthorizer>::Error>

Returns the current account after applying its authorization policy.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<User, Database, Sessions, Identifier> AccountSession for AuthSession<User, Database, Sessions, Identifier>
where Database: Clone + Debug + Send + Sync + 'static, Sessions: DatabasePool + Clone + Debug + Send + Sync + 'static, User: AccountAuthorizer + Authentication<User, Identifier, Database> + Send, Identifier: Eq + Default + Clone + Send + Sync + Hash + Serialize + DeserializeOwned + 'static,

Source§

type Account = User