Skip to main content

Module auth

Module auth 

Source
Expand description

Test authentication builder and utilities. Test authentication utilities.

Provides a builder-based API for setting up authentication state in tests, replacing the deprecated force_authenticate method.

§Architecture

  • ForceLoginUser: Trait for extracting session identity from any user type. Blanket-implemented for all AuthIdentity types (available on native targets).
  • SessionIdentity: Type-erased identity struct matching CookieSessionAuthMiddleware fields.
  • AuthBuilder: Entry point returned by APIClient::auth().
  • SecondaryAuth: Open trait for secondary auth layers (MFA, PassKey, etc.).

§Platform Support

Session/JWT builders, TOTP secondary auth, and AuthIdentity blanket impl are available unconditionally on native targets (non-wasm).

Structs§

AuthBuilder
Entry point for building auth configurations on an APIClient.
JwtAuthBuilder
Builder for JWT test authentication.
JwtTestConfig
JWT configuration for test contexts.
ServerFnAuthBuilder
Builder for auth configuration in server_fn test contexts.
SessionAuthBuilder
Builder for session-based test authentication.
SessionIdentity
Type-erased session identity, decoupled from the user’s concrete type.
TotpSecondaryAuth
TOTP MFA secondary authentication for tests.

Enums§

TestAuthError
Errors that can occur during test authentication setup.

Traits§

ForceLoginUser
Trait for extracting session-storable identity from any user type.
SecondaryAuth
Secondary (multi-factor) authentication layer.