Skip to main content

puerto_auth/
lib.rs

1//! Puerto's auth runtime (ADR-0021): the adapters of `puerto_nucleo::auth::Autenticador`.
2//!
3//! - feature `oidc` — [`oidc::AutenticadorOidc`]: verifies the access tokens of an OpenID Connect
4//!   provider (Auth0, Keycloak, …) and reads the caller's roles from a configurable claim. Which
5//!   provider is configuration, not code.
6//! - feature `local` — [`local::HasherArgon2`]: the `HasherContrasena` of a project that keeps its own
7//!   accounts. Its sessions, and the `Autenticador` that reads them, are `puerto-sqlx`'s.
8//!
9//! A route never sees which one checked its caller: `puerto_web::auth::BearerAuth` asks the
10//! `Arc<dyn Autenticador>` that `bootstrap.rs` registers.
11
12#[cfg(feature = "local")]
13pub mod local;
14#[cfg(feature = "oidc")]
15pub mod oidc;
16
17#[cfg(feature = "oidc")]
18pub use oidc::{AutenticadorOidc, ClaimRoles, ConfigOidc, ErrorConfigOidc, ErrorOidc};
19pub use puerto_nucleo::auth::{Autenticador, ErrorAuth, Principal};