Skip to main content

keystate_adapter_keycloak/
lib.rs

1//! # keystate-adapter-keycloak
2//!
3//! Keycloak database extraction adapter for **Keystate** — the concrete
4//! [`keystate_core::port::Extractor`] implementation that reads a Keycloak
5//! realm's configuration state directly out of its PostgreSQL database and
6//! maps it into the canonical model defined by
7//! [`keystate_core`](https://github.com/KeyState/keystate-core).
8//!
9//! This crate is deliberately **one backend, one job**: it knows Keycloak's
10//! schema and nothing else. The canonical model, verification engine, and
11//! output ports all live in `keystate-core`; this crate only implements the
12//! [`keystate_core::port::Extractor`] and
13//! [`keystate_core::port::CompletenessVerifier`] ports against Keycloak's
14//! database.
15//!
16//! # Module map
17//!
18//! - [`db`] — everything that speaks PostgreSQL: the read-only connection,
19//!   schema-version detection, and the database-layer error type.
20//! - [`extract`] — per-entity extraction: one module per canonical entity,
21//!   returning native JSON faithful to Keycloak's own field shape.
22//! - [`manifest`] — per-version field manifests describing what a given
23//!   Keycloak version must expose.
24//! - [`export`] — rendering the canonical extraction into Keycloak's
25//!   importable realm-export format for the config-cli round-trip validation.
26//!
27//! See `ARCHITECTURE.md` in this repository for the full design, and the
28//! companion `keystate-core` crate for the ports and canonical model.
29
30#![warn(missing_docs)]
31
32pub mod db;
33pub mod export;
34pub mod extract;
35pub mod manifest;
36
37pub use db::{KeycloakConnection, SUPPORTED_KEYCLOAK_VERSION, detect_keycloak_version};
38pub use export::realm_export;
39pub use extract::{KeycloakExtractor, merge_attributes, realm_from_native};
40pub use manifest::keycloak_manifest;
41
42/// The adapter's database-layer error type.
43pub use db::Error;
44/// The adapter's database-layer result alias.
45pub use db::Result;