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 controllers::AuthOauth;
pub use controllers::AuthPasswords;
pub use controllers::AuthRegistrations;
pub use controllers::AuthSessions;
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 route_mount::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;
pub use user::RegisterableAuthUser;

Modules§

config
auth: section of config/<env>.ymlAuthConfig.
controllers
Default auth controllers shipped with doido-auth.
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.
route_mount
Programmatic auth router (mount) for apps without generated controllers.
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.

Macros§

__auth_routes_decl
Internal: expands to get!/post!/… lines consumed by [doido_auth::routes!].
auth_routes
Standalone Devise-style auth router (.merge(doido_auth::auth_routes!(User))).
routes
Application route table with Devise-style auth_routes! (like devise_for).

Attribute Macros§

auth_controller
Marks an auth controller impl, preserving generic type parameters (unlike doido_controller::controller on impl<U> …).