iet-auth-basic-axum
integration adapter official
Registers a JSON login endpoint over the password-auth contracts.
CoreFeaturesIntegrationsStacksTooling
Used byno framework crate yetexamples/htmx-starter
iet-auth-basic-axumadapterPassword-login REST adapterDepends oniet-corecontractiet-authcontractiet-http-axumcontract
How to use it
Registers a JSON password-login endpoint on a iet_http_axum::RestApi: it authenticates via
iet_auth::Authenticate<PasswordCredentials> and returns a bearer token from
iet_auth::TokenIssuer. Pair it with any credential verifier and token provider; the route
is mounted as the auth.basic module.
// examples/htmx-starter/servers/web/tests/framework_auth_rest.rs
- Responses are
Cache-Control: no-store; the module registers a fixed 10/60s rate-limit policy. - Invalid bodies/credentials are mapped to validated HTTP errors without echoing secrets.
How it works
register mounts the path as the named auth.basic module with an inline rate-limit policy and stores (authenticator, issuer) as router state; the handler validates LoginRequest, calls Authenticate<PasswordCredentials>, then TokenIssuer::issue and returns a JSON TokenResponse.
flowchart LR Req["POST path"] --> Module["auth.basic module"] Module --> Login["api login"] Login --> Val["ValidatedJson LoginRequest"] Val --> Auth["Authenticate PasswordCredentials"] Auth --> Iss["TokenIssuer issue"] Iss --> Resp["TokenResponse no-store"]
What it implements
- Concrete mechanism; see the public API below.
What's inside
Modules
src/api.rssrc/dto.rssrc/injector.rssrc/lib.rs
Public API
dto
- struct
LoginRequest
injector
pub fn register<S, A, I, L>( api: RestApi<S, L>, path: &str, authentication: Arc<A>, issuer: Arc<I>, ) -> AppResult<RestApi<S, L>> where L: iet_http_axum::RateLimit,— Registers password login atpath; other auth capabilities remain opt-in.
Impl map
Validate for LoginRequest
Depends on
External crates: axum, serde
Used by
- No other framework crate depends on it directly.
In this repository
examples/htmx-starter
Source: crates/integrations/iet-auth-basic-axum