Expand description
Optional conventional browser identity: database sessions and explicit policies.
Applications normally use this through capy::auth and capy make:auth.
Re-exports§
pub use verification::LocalVerificationDelivery;pub use verification::MemoryVerificationDelivery;pub use verification::VerificationDelivery;pub use verification::VerificationMessage;pub use verification::VerificationStatus;pub use verification::VerifyEmailRequest;pub use password::PasswordService;
Modules§
- migration
- Conventional, reversible SeaORM identity schema shared with the installer.
- password
- Per-application bounded Argon2id workers. Admission is async; hashing is blocking.
- verification
- Framework-owned verification proofs with an application-owned delivery adapter.
Structs§
- Auth
Service - Shared auth runtime. One instance per application preserves process-local throttles.
- Auth
Settings - Small, typed settings for the optional conventional identity system.
- Auth
Throttle Limit - Fixed-window abuse budget. Zero never implicitly disables a limit.
- Auth
Throttle Settings - Separate fixed windows for CSRF bootstrap, registration, login, reset request and reset completion. Limits apply per action; account keys span client IPs. Application-owned verification endpoints need their own request-level limiter.
- Auth
User - Required authenticated identity. Invalid, expired, deleted, or absent identities return 401.
- Csrf
Response - CSRF bootstrap response; do not log it or cache it.
- Email
Verified - The first transition from unverified to verified, before commit. Replay does not emit another event. Verification proof is application-owned.
- Forgot
Password Request - Password reset request; the public response does not reveal account existence.
- Local
Reset Delivery - Development-only private file inbox. Unix files are created with mode 0600 in a mode 0700 directory; production refuses this adapter. No reset secrets are logged.
- Logged
Out - An authenticated session was actually deleted, before commit.
- Login
Request - Login input; failures do not distinguish unknown users from incorrect passwords.
- Login
Succeeded - Password verification succeeded and a session was rotated, before commit.
- Memory
Reset Delivery - In-memory delivery for local development and tests. Refused in production. An application can expose a local CLI inbox without logging credentials.
- Optional
Auth - Optional identity. Only an absent cookie or valid anonymous CSRF session yields None. Malformed, unknown, expired, or deleted-user sessions still return 401.
- Password
Reset Completed - A reset token was consumed, password changed and sessions revoked, before commit.
- Password
Settings - Per-application Argon2id admission and resource limits (
AUTH_PASSWORD_*). - Register
Request - Registration input. Debug redacts the password.
- Reset
Message - Explicit delivery payload, redacted in Debug and not serializable.
- Reset
Password Request - Single-use reset credential and replacement password.
- Reset
Requested Response - Constant public reset-request response.
- Secret
- An input secret: deserializable, deliberately not serializable, redacted in Debug.
- User
Registered - A new user and authenticated session have been inserted, before commit.
- User
Response - Public identity; persistence/security fields never cross the API boundary.
Enums§
- Hash
Concurrency - Automatic hardware/budget selection or an explicit worker count.
- Same
Site - Cookie policy. Cross-site cookies are intentionally outside the built-in path.
Traits§
- Policy
- A small explicit policy: applications choose their identity, action, and resource types. Use an action enum or distinct action types; no runtime permission registry is required.
- Reset
Delivery - Application-owned delivery. Never put reset credentials in logs or request URLs.
Functions§
- normalize_
email - Deterministic whole-address lowercase and whitespace trimming. This deliberately treats case variants as one account, with no alias/dot rewriting.
- prune
- Delete expired sessions and reset credentials. Invoke from a scheduled application/DB job
or
capy auth:prune; no scheduler is created by Capy. - routes
- Typed conventional route contracts, mounted by
App::authunder/api/auth. - verification_
routes - Opt-in routes for the framework-owned email verification flow; mounted under /api/auth.