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
74
75
76
77
78
//! Keycloak integration for authentication and authorization.
//!
//! This crate provides utilities for managing Keycloak realms, clients, users,
//! roles, and tokens. Keycloak is used for OAuth2/OIDC authentication and
//! role-based access control.
//!
//! ## Features
//!
//! - **Realm Management**: Create and manage Keycloak realms
//! - **Client Management**: Configure OAuth clients with protocols and mappers
//! - **User Management**: Create, update, delete, and authenticate users
//! - **Role Management**: Client and realm roles
//! - **Token Management**: JWT token validation and refresh
//! - **Session Management**: Browser session handling
//! - **Configuration**: Environment-based configuration
//!
//! ## Usage
//!
//! \```ignore
//! use qm_keycloak::{Keycloak, KeycloakConfig};
//!
//! #[tokio::main]
//! async fn main() -> anyhow::Result<()> {
//! let config = KeycloakConfig::new()?;
//! let keycloak = Keycloak::new(config).await?;
//! let users = keycloak.get_users("realm").await?;
//! Ok(())
//! }
//! \```
//!
//! ## Environment Variables
//!
//! | Variable | Description | Default |
//! |----------|-------------|---------|
//! | `KEYCLOAK_URL` | Keycloak server URL | `http://127.0.0.1:8080` |
//! | `KEYCLOAK_REALM` | Default realm | `master` |
//! | `KEYCLOAK_CLIENT_ID` | Client ID for admin | `admin-cli` |
//! | `KEYCLOAK_USERNAME` | Admin username | (none) |
//! | `KEYCLOAK_PASSWORD` | Admin password | (none) |
//!
//! ## Development
//!
//! In the development environment, Keycloak can be found in a Kubernetes
//! at <https://keycloak.qm.local>.
//! If Keycloak is missing, you need to run
//! `k8s/helm-charts/skaffold/skaffold.infra-1-base.yaml`.
//!
//! Default username/password: `admin`/`Admin123`
/// Session management.
pub use *;
/// Configuration for keycloak.
/// Realm management.
/// Schema definitions.
/// Token handling.
/// Validation utilities.
pub use JwtStore;
/// Macro to implement AsRef<Keycloak> for storage types.