alibi-core 0.2.0

Shared authentication contracts and backend-independent services for Alibi
Documentation
//! Schema traits for binding Alibi to application-owned auth models.

use crate::entity::{AuthAccount, AuthSession, AuthUser, AuthVerification};

/// App-owned auth schema declaration.
pub trait AuthSchema: Send + Sync + 'static {
    /// Wire model projections for this application schema.
    /// Add application fields here with their actual input/output policy; database
    /// column names do not change canonical accessor-backed wire field names.
    #[must_use]
    fn openapi_models() -> Vec<crate::openapi::OpenApiModel> {
        crate::openapi::annotations::core_models()
    }

    /// Preserve an authenticated cache snapshot only when the application user
    /// type is itself a wire snapshot. Never reconstruct a database model from
    /// cookie data. Typed physical guards reject cached-only authority otherwise.
    fn user_from_cookie_cache(_user: crate::UserView) -> Option<Self::User> {
        None
    }

    type User: AuthUser;
    type Session: AuthSession;
    type Account: AuthAccount;
    type Verification: AuthVerification;
}