1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
/*! # Keycloak Admin REST API ## Features Implements Keycloak Admin REST API version 11. ## Usage Add dependency to Cargo.toml: ```toml [dependencies] keycloak = "11" ``` ```rust#ignore use keycloak::{KeycloakAdmin, KeycloakAdminToken}; use keycloak::types::*; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { let url = "http://localhost:9080"; let client = reqwest::Client::new(); let admin_token = KeycloakAdminToken::acquire(url, "admin", "password", &client).await?; eprintln!("{:?}", admin_token); let admin = KeycloakAdmin::new(url, admin_token, client); admin .users_post( "test", UserRepresentation { username: Some("user".into()), ..Default::default() }, ) .await?; let users = admin .users_get( "test", None, None, None, None, None, None, None, None, None, None, ) .await?; eprintln!("{:?}", users); let id = users .iter() .find(|u| u.username == Some("user".into())) .unwrap() .id .as_ref() .unwrap() .to_string(); admin.users_delete("test", id.as_str()).await?; Ok(()) } ``` */ pub mod types; mod error; mod rest; pub use error::KeycloakError; pub use rest::{KeycloakAdmin, KeycloakAdminToken};