keycloak
Keycloak publishes its admin API as one big OpenAPI document, and it moves with every Keycloak release. A hand-written client is behind the day it is written. So this one is generated, in lockstep: the crate version matches the Keycloak release it speaks to.
What changes for you
- No stringly-typed URLs. All 415 operations are methods with typed bodies and parameters, named after the API's own resources.
- You only pay for what you use. Each resource group is a
feature (
tag-users,tag-clients, …). Default builds enable all of them; a small service can enable three and compile the rest away. - Types, not JSON blobs. Requests and responses are the schemas
from the description, with
Optionfor what the API treats as optional. - Optional extras. A resource builder for fluent calls,
schemarssupport for JSON Schema, andArc-based types (rc) when sharing representations matters.
Getting it
cargo add keycloakThen acquire an admin token and call the API:
let token = KeycloakAdminToken::acquire(&url, &user, &password, &client).await?;
let admin = KeycloakAdmin::new(&url, token, client);
let clients = admin.realm_clients_get("master", None, Some(0), Some(10), None, None, None).await?;Turning features off keeps a build lean:
[dependencies]
keycloak = { version = "26.8.100", default-features = false, features = ["reqwest", "tag-users", "tag-clients"] }