Skip to main content

Crate puerto_auth

Crate puerto_auth 

Source
Expand description

Puerto’s auth runtime (ADR-0021): the adapters of puerto_nucleo::auth::Autenticador.

  • feature oidc — [oidc::AutenticadorOidc]: verifies the access tokens of an OpenID Connect provider (Auth0, Keycloak, …) and reads the caller’s roles from a configurable claim. Which provider is configuration, not code.
  • feature local — [local::HasherArgon2]: the HasherContrasena of a project that keeps its own accounts. Its sessions, and the Autenticador that reads them, are puerto-sqlx’s.

A route never sees which one checked its caller: puerto_web::auth::BearerAuth asks the Arc<dyn Autenticador> that bootstrap.rs registers.

Structs§

Principal
The authenticated caller.

Enums§

ErrorAuth
Why a token did not become a Principal. The first two are the caller’s (401), the last is ours (503): the adapter logs the cause, the API answers the code.

Traits§

Autenticador
Turns a bearer token into the caller. bootstrap.rs registers one on the routes; puerto_web::auth::BearerAuth asks it on every protected request.