Expand description
authentication providers
Modules§
- api_key
- API key authentication
- axum
- Axum middleware for HTTP authentication Axum middleware for HTTP authentication
- client_
ip - Client IP resolution (X-Forwarded-For / X-Real-IP / socket address), shared by every
RequestPartsconstruction site and byip_allowlist’s allowlist check. Resolves the client IP address from request headers/extensions. - db_
api_ key - DB-backed API key authentication DB-backed API key authentication.
- db_
audience_ grants - DB-backed audience grant store
DB-backed audience grant store: a whole-table snapshot cache over the
audience_grantstable (migration v7,rust/ingestion/src/sql_migration.rs), checked alongside the static grant map bycrate::policy::AudienceReadPolicy/crate::policy::AudienceMintPolicy– a selector present in either source grants access, without either side being deep-cloned or merged into a combined map (current()hands back the cached grants behind anArc). This is what makes a grant creatable without a service restart – the static map stays the bootstrap/test-only layer. - db_
snapshot - Generic whole-table snapshot cache shared by the audience-grant and group stores
Generic whole-table snapshot cache, extracted from what used to be
db_audience_grants.rs’s entire cache-mechanics implementation.crate::db_snapshot::SnapshotLoaderis the one thing each store (audience grants, groups) supplies: how to fetch a fresh snapshot and which metric/name to report on a refresh failure.crate::db_snapshot::SnapshotSourceis everything else – cold-start throttling, last-good serving after the first success,ProviderUnavailablewrapping – copied unchanged from the originalDbAudienceGrantsSource. - default_
provider - Default authentication provider initialization Default authentication provider initialization for Micromegas services.
- env
- Shared prefixed-env-var resolution (
{prefix}_{suffix}withMICROMEGAS_{suffix}fallback) Shared prefixed-env-var resolution, used by every{prefix}_*-with-fallback knob in this crate ({prefix}_OIDC_CONFIG,{prefix}_DEFAULT_AUDIENCE), and the three surviving{prefix}_API_KEY_*CACHE*knobs ({prefix}_API_KEY_CACHE_SIZE,{prefix}_API_KEY_UNKNOWN_CACHE_TTL_SECONDS,{prefix}_API_KEY_UNKNOWN_CACHE_SIZE). - groups
- Local group membership:
GroupGraph, the DB-backed store, and closure resolution Local group membership: thegroups/group_memberstables (migration v10,rust/ingestion/src/sql_migration.rs), a whole-table snapshot cache (crate::groups::DbGroupsSource) mirroringcrate::db_audience_grants::DbAudienceGrantsSource, andcrate::groups::GroupGraph, the in-memory closure resolver over a loaded snapshot. - ip_
allowlist - A typed, CIDR-based IP allowlist – the decision point
ApiKeyAuthProviderandDbApiKeyAuthProviderboth call to enforce a per-key source-IP restriction. A typed, allowlist-only IP allowlist: a set of CIDR ranges (or bare IPs, treated as a/32or/128) a credential may be presented from. An empty allowlist means “no restriction” – the backward-compatible default for every key minted before this feature existed. - membership
- Wraps an
AuthProviderto resolve transitive local-group membership per request Wraps an innercrate::types::AuthProviderand resolves the caller’s transitive local-group membership once per request – the one resolution site upstream of every consumer (is_admin(),caller_selectors/selector_matches’sgroup:arm). - multi
- Multi-provider authentication (API key + OIDC) Multi-provider authentication that tries multiple auth methods in sequence.
- oauth_
state - OAuth state parameter signing and verification OAuth state parameter signing and verification
- oidc
- OIDC authentication with JWKS caching
- oidc_
client - Canonical login-flow OIDC client construction (discovery + client building) Canonical login-flow OIDC client construction.
- policy
- Authorization seam:
MintPolicy,ReadPolicy, and their audience-based implementations Authorization seam:MintPolicy,ReadPolicy, and the audience-based implementations that resolve them from a caller’sAuthContextand a static grant map keyed by audience name. - tower
- Tower service layer for tonic/gRPC authentication Tower service layer for async authentication with tonic/gRPC.
- types
- Core authentication types and traits
- url_
validation - URL validation utilities for authentication flows URL validation utilities for authentication flows
- user_
attribution - User attribution validation (prevents impersonation attacks) User attribution validation for preventing impersonation attacks