Skip to main content

doido_auth/
lib.rs

1//! Unified authentication for Doido — Devise + OmniAuth + JWT analogue.
2
3pub mod config;
4pub mod controllers;
5pub mod error;
6pub mod extractors;
7pub mod handlers;
8pub mod identity;
9pub mod jwt;
10pub mod layer;
11pub mod oauth;
12pub mod registry;
13pub mod route_mount;
14pub mod session;
15pub mod state;
16pub mod strategy;
17pub mod user;
18
19pub mod testing;
20
21#[cfg(feature = "auth-2fa")]
22pub mod two_factor;
23
24#[cfg(feature = "auth-2fa")]
25pub use controllers::AuthTwoFactor;
26
27pub use config::{load as load_config, AuthConfig, AuthRoutesConfig, JwtConfig, YamlConfig};
28pub use controllers::{AuthOauth, AuthPasswords, AuthRegistrations, AuthSessions};
29pub use doido_auth_macros::{__auth_routes_decl, auth_controller, auth_routes, routes};
30pub use error::AuthError;
31pub use extractors::{AuthToken, CurrentUser, MaybeUser, RequireAuth};
32pub use handlers::{authenticate, register_user, sign_in, sign_in_with_session, sign_out};
33pub use identity::AuthIdentity;
34pub use jwt::{JwtClaims, JwtStrategy, TokenPair};
35pub use layer::{auth_layer, current_identity, current_user};
36pub use oauth::{OAuth2Provider, OAuthProvider, OAuthTokenResponse};
37pub use registry::{register_strategy, registered_strategies};
38pub use route_mount::mount;
39pub use session::{
40    SessionStrategy, SessionStrategy as CookieStrategy, SESSION_COOKIE, USER_ID_KEY,
41};
42pub use state::{global, init, set_state, try_global, AuthState};
43pub use strategy::AuthStrategy;
44pub use user::{authenticate_password, AuthUser, RegisterableAuthUser};
45
46#[cfg(feature = "auth-2fa")]
47pub use two_factor::{
48    enroll as enroll_two_factor, verify_code as verify_two_factor_code, TwoFactorEnrollment,
49};
50
51#[cfg(feature = "generators")]
52pub mod generators;