lib.rs
73 lignes · 3193 octets
//! Rustwarden Core //! //! Reusable web framework for user management, authentication, and RBAC. //! Use this crate as a dependency to add secure authentication to any Axum application. /// Application setup and router builder. pub mod app; /// Authentication extractors, JWT service, and session management. pub mod auth; /// Server, database, authentication, and email configuration. pub mod config; /// Dashboard extension surface (`DashboardCardDTO`) used by companion /// crates to inject extra cards into the admin dashboard. pub mod dashboard; /// Application error types and HTTP response conversion. pub mod error; /// Extension hooks for consumer applications to react to framework events. pub mod hooks; /// Internationalization utilities. pub mod i18n; /// Unified actor abstraction (RFC 0008). /// /// `Identity` and `IdentityResolver` stay in core (no federation dep) /// because the framework's auth middleware, RBAC, and resource services /// must distinguish local vs. remote callers even when the /// `rustwarden-fediverse` crate is not linked. ActivityPub federation /// itself moved to `rustwarden-fediverse` (RFC 0001+). pub mod identity; /// Axum middleware: authentication, CSRF, rate-limiting, error handling. pub mod middleware; /// SeaORM database migrations bundled with the core crate. /// /// Use `core_migrations()` to retrieve the migration list, /// then pass it to `RustwardenApp::auto_migrate` or run it manually. pub mod migrations; /// SeaORM entity models. pub mod models; /// Server-sent events and in-memory notification bus (`InMemoryBus`). pub mod notifications; /// Business logic services (auth, users, roles, resources, teams, etc.). pub mod services; /// Background task processors. pub mod tasks; /// Askama HTML templates. pub mod templates; /// Domain-specific newtype wrappers. pub mod types; /// Prelude module re-exporting the most commonly used types. pub mod prelude { pub use crate::app::RustwardenApp; pub use crate::auth::extractors::AuthUser; pub use crate::auth::jwt::{Claims, JwtService}; pub use crate::config::analytics::{ AnalyticsConfig, AnalyticsContext, AnalyticsHandle, AnalyticsState, }; pub use crate::config::security_headers::SecurityHeadersConfig; pub use crate::error::AppError; pub use crate::hooks::RustwardenHooks; pub use crate::notifications::sse::sse_response; pub use crate::notifications::{EventFilter, InMemoryBus, NotificationBus}; pub use crate::services::permission_service::PermissionService; pub use crate::services::personal_token_service::{PersonalTokenService, TokenScope}; pub use crate::services::rate_limit_service::RateLimitService; pub use crate::services::resource_service::{Principal, ResourceService}; pub use crate::services::role_service::RoleService; pub use crate::services::team_service::{TeamRole, TeamService}; pub use crate::services::user_service::UserService; pub use crate::tasks::pending_email_change_cleanup::PendingEmailChangeCleanupProcessor; pub use crate::tasks::personal_token_cleanup::PersonalTokenCleanupProcessor; pub use crate::types::TeamSlug; pub use crate::types::Username; }
GitRust