Skip to main content

AuthSession

Type Alias AuthSession 

Source
pub type AuthSession<User, Database, Sessions = SessionNullPool, Identifier = String> = AuthSession<User, Identifier, Sessions, Database>;
Expand description

Authenticated Axum session using the application’s selected session store.

Aliased Type§

pub struct AuthSession<User, Database, Sessions = SessionNullPool, Identifier = String> {
    pub id: Identifier,
    pub current_user: Option<User>,
    pub session: Session<Sessions>,
    /* private fields */
}

Fields§

§id: Identifier§current_user: Option<User>§session: Session<Sessions>

Trait Implementations§

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

Account loaded by the session.
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.