iet-auth-basic-timescale
Persists identifiers and password hashes for the password-auth contracts.
iet-auth-basic-timescaleimplementationTimescaleDB credential storeHow to use it
Owns fw_auth_credentials and fw_auth_identifiers and implements iet_auth::CredentialStore
by resolving a login to a password account. Register it after iet_auth_identity_timescale,
then feed CredentialStore::new(db) into iet_auth_basic::BasicAuth.
// examples/skills-only-app-task-tracker/servers/web/src/providers.rs
let auth = new;
// Registration: examples/skills-only-app-task-tracker/servers/web/src/database.rs
let mut registry = default;
register?;
register?;
- The crate does not own the identity table; registration fails unless
iet_auth_identity_timescalewas registered first. - Unknown/illegal logins return
Ok(None)rather than an error.
How it works
CredentialStore::account bounds the login with valid_identifier, then repository::account runs one query that joins fw_auth_identifiers to fw_auth_credentials and fw_auth_identities, returning a PasswordAccount only for enabled identities.
flowchart LR Auth["BasicAuth authenticate"] --> Store["CredentialStore"] Store --> Valid["valid_identifier"] Valid --> Repo["repository account"] Repo --> Ident["fw_auth_identifiers"] Repo --> Cred["fw_auth_credentials"] Repo --> Idn["fw_auth_identities"] Repo --> Acct["PasswordAccount"]
What it implements
- Implements
iet_auth::CredentialStorefromiet-auth.
Database schema
fw_auth_credentialsentity Credential · hard deletesubjectuuid::Uuidpassword_hashStringfw_auth_identifiersentity Identifier · hard deleteidentifierStringsubjectuuid::UuidThe details below come from #[derive(Persistent)] entity metadata:
fw_auth_credentials
Entity Credential (hard delete).
| Column | Rust type | Attributes |
|---|---|---|
subject | uuid::Uuid | primary key |
password_hash | String |
Foreign key auth_credential_subject: (subject) → fw_auth_identities (id)
fw_auth_identifiers
Entity Identifier (hard delete).
| Column | Rust type | Attributes |
|---|---|---|
identifier | String | primary key |
subject | uuid::Uuid |
Foreign key auth_identifier_subject: (subject) → fw_auth_credentials (subject)
Entities register into an EntityRegistry; EntityRegistry::initial
emits a reviewed migration pair, and Migrations applies reviewed files.
See iet-db-timescale and
iet-db.
What's inside
Modules
src/entity.rssrc/lib.rssrc/repository.rssrc/stores.rs
Public API
(root)
pub fn register(registry: &mut EntityRegistry) -> AppResult<()>— Register owned tables; register identity tables separately before generating SQL.
entity
- struct
Credential - struct
Identifier
stores
- struct
CredentialStore pub fn new(database: TimescaleDatabase) -> Self
Impl map
iet_auth::CredentialStore for CredentialStore
Depends on
External crates: sqlx, uuid
Used by
- No other framework crate depends on it directly.
In this repository
examples/htmx-starterexamples/skills-only-appexamples/skills-only-app-task-tracker
Source: crates/integrations/iet-auth-basic-timescale