Skip to main content

Crate doido_auth

Crate doido_auth 

Source
Expand description

Unified authentication for Doido — Devise + OmniAuth + JWT analogue.

Re-exports§

pub use config::load as load_config;
pub use config::AuthConfig;
pub use config::AuthRoutesConfig;
pub use config::JwtConfig;
pub use config::YamlConfig;
pub use error::AuthError;
pub use extractors::AuthToken;
pub use extractors::CurrentUser;
pub use extractors::MaybeUser;
pub use extractors::RequireAuth;
pub use handlers::authenticate;
pub use handlers::register_user;
pub use handlers::sign_in;
pub use handlers::sign_in_with_session;
pub use handlers::sign_out;
pub use identity::AuthIdentity;
pub use jwt::JwtClaims;
pub use jwt::JwtStrategy;
pub use jwt::TokenPair;
pub use layer::auth_layer;
pub use layer::current_identity;
pub use layer::current_user;
pub use oauth::OAuth2Provider;
pub use oauth::OAuthProvider;
pub use oauth::OAuthTokenResponse;
pub use registry::register_strategy;
pub use registry::registered_strategies;
pub use routes::mount;
pub use session::SessionStrategy;
pub use session::SessionStrategy as CookieStrategy;
pub use session::USER_ID_KEY;
pub use state::global;
pub use state::init;
pub use state::set_state;
pub use state::try_global;
pub use state::AuthState;
pub use strategy::AuthStrategy;
pub use user::authenticate_password;
pub use user::AuthUser;

Modules§

config
auth: section of config/<env>.ymlAuthConfig.
error
Typed auth errors (thiserror per crate, per the framework convention).
extractors
Axum extractors for authenticated requests.
generators
Shared helpers for auth generators — migration rendering, name inflection, and route/module injection.
handlers
Sign-in, sign-up, and sign-out helpers built on AuthUser and bcrypt.
identity
Resolved auth subject identity before the full user model is loaded.
jwt
JWT bearer strategy — sign/verify access and refresh tokens.
layer
Axum middleware that resolves auth identity via enabled strategies.
oauth
OAuth provider registry — abstract interface + config-driven OAuth 2.0 impl.
registry
Custom strategy registration at boot.
routes
Pre-built auth routes (sessions, registration, passwords, OAuth).
session
Cookie/session strategy — integrates with doido_controller::session.
state
Process-global auth state installed at boot.
strategy
Pluggable authentication strategies.
testing
Test helpers and in-memory fakes for auth integration tests.
user
Generic authenticated subject contract — apps implement this on their User model.