Expand description
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
Re-exports§
Modules§
- config
- Configuration for keycloak.
- realm
- Realm management.
- schema
- Schema definitions.
- session
- Session management.
- token
- Token handling.
- types
- validation
- Validation utilities.
Macros§
- keycloak
- Macro to implement AsRef
for storage types.
Structs§
- Authentication
Execution Info Representation - Authentication
Flow Representation - Authenticator
Config Representation - Client
Representation - Credential
Representation - Group
Representation - Identity
Provider Representation - Keycloak
- Keycloak client for managing authentication and authorization.
- Keycloak
Admin - Keycloak
Builder - Builder for creating Keycloak client instances.
- Realm
Info - Realm information for Keycloak including public key.
- Realm
Representation - Role
Representation - Server
Info - Server information for Keycloak.
- User
Representation
Enums§
Traits§
Functions§
- idp_
signature_ and_ encryption - Sets up IDP signature and encryption settings.