70 releases

0.0.80 Jul 7, 2026
0.0.78 May 21, 2026
0.0.73 Mar 13, 2026
0.0.67 Nov 27, 2025
0.0.13 Mar 28, 2024

#1476 in Authentication

Download history 181/week @ 2026-04-16 211/week @ 2026-04-23 31/week @ 2026-04-30 53/week @ 2026-05-07 48/week @ 2026-05-14 40/week @ 2026-05-21 92/week @ 2026-05-28 33/week @ 2026-06-04 59/week @ 2026-06-11 47/week @ 2026-06-18 164/week @ 2026-06-25 96/week @ 2026-07-02 47/week @ 2026-07-09 108/week @ 2026-07-16 48/week @ 2026-07-23 73/week @ 2026-07-30

303 downloads per month
Used in 3 crates

MIT license

215KB
4.5K SLoC

Quick Microservices Keycloak - qm-keycloak

utilities to work with a Keycloak server and managing authentication and authorization


GitHub repositoryCargo packageDocs

github.com - quick-microservice-rs crates.io - qm-keycloak
github.com - workflow - build


Description

With this crate it is easy to get a Keycloak configuration with the most common settings. It also provides token management and session handling as well as Keycloak configuration validation.

Usage

let keycloak_config = qm::keycloak::KeycloakConfig::new()?;

The Config is populated with environment variables. By default, all variables with the prefix KEYCLOAK_ are considered.

The prefix can be changed by using a builder pattern.

let example_config = qm::keycloak::KeycloakConfig::builder().with_prefix("EXAMPLE_").build()?;

Variables and Defaults

These variables are available and are set with the following defaults.

variable struct field default
KEYCLOAK_REALM realm "rmp"
KEYCLOAK_CLIENT_ID client_id "spa"
KEYCLOAK_USERNAME username "admin"
KEYCLOAK_PASSWORD password "admin"
KEYCLOAK_THEME theme "qm"
KEYCLOAK_EMAIL_THEME email_theme "qm"
KEYCLOAK_REALM_ADMIN_EMAIL realm_admin_email "admin@test.local"
KEYCLOAK_REALM_ADMIN_USERNAME realm_admin_username "admin"
KEYCLOAK_REALM_ADMIN_PASSWORD realm_admin_password "Admin123!"
KEYCLOAK_PORT port 42210
KEYCLOAK_HOST host "127.0.0.1"
KEYCLOAK_ADDRESS address http://{host}:{port}/
KEYCLOAK_PUBLIC_URL public_url "http://127.0.0.1:80"
KEYCLOAK_SMTP_REPLY_TO_DISPLAY_NAME smtp_reply_to_display_name
KEYCLOAK_SMTP_STARTTLS smtp_starttls false
KEYCLOAK_SMTP_PORT smtp_port 1025
KEYCLOAK_SMTP_HOST smtp_host "smtp"
KEYCLOAK_SMTP_REPLY_TO smtp_reply_to
KEYCLOAK_SMTP_FROM smtp_from "noreply@test.local"
KEYCLOAK_SMTP_FROM_DISPLAY_NAME smtp_from_display_name
KEYCLOAK_SMTP_SSL smtp_ssl false
KEYCLOAK_BROWSER_FLOW browser_flow "browser"
KEYCLOAK_AUTHENTICATOR_EMAIL_SUBJECT authenticator_email_subject "Temporary Authentication Code"

Dependencies

~47–63MB
~1M SLoC