TiloBox
Back to directory
Keycloak project preview

Keycloak

Keycloak is an identity and access management server for applications and services.

LicenseApache-2.0
GitHub stars36.4k
Last commit1 weeks ago
Tags5 topics
Self HostedOidcSamlIdentityJava
Overview

Why consider Keycloak?

Open Source Identity and Access Management for Modern Applications and Services.

Guided learning

Learn Keycloak by building

Practical setup notes, real use cases, and copy-ready examples in one focused guide.

3 min read 4 sections
In this guide4 sections

Open Source Identity and Access Management

Keycloak is an open-source identity and access management solution that lets you add authentication to applications and secure services with minimum effort. Instead of having to deal with storing users or authenticating users yourself, Keycloak provides user federation, strong authentication, user management, fine-grained authorization, and more out of the box.

Configuration Sources

Keycloak loads the configuration from four sources, which are listed here in order of application: command-line parameters, environment variables, options defined in the conf/keycloak.conf file, and sensitive options defined in a Java KeyStore file. You can choose the format that makes the most sense for your environment.

When an option is set in more than one source, the one that comes first in the list determines the value for that option. For example, a command-line parameter takes priority over an environment variable.

Running Keycloak via Container Images

You can run Keycloak efficiently by creating a custom container image. The default Keycloak container image ships ready to be configured and optimized. Keycloak can be run in a Docker container or any Podman/Buildah environment using a Containerfile.

To achieve the best startup performance, it is recommended to build an image by running the build step during the container build. Running the build step during the container build saves time in every subsequent start phase of the container image.

Creating an Optimized Container Image

You can configure a custom Containerfile to build an optimized Keycloak image with a PostgreSQL database, health and metrics endpoints, and token exchange feature enabled. Below is an official example Containerfile that enables these features and configures PostgreSQL:

dockerfile
1FROM quay.io/keycloak/keycloak:{containerlabel} AS builder
2
3# Enable health and metrics support
4ENV KC_HEALTH_ENABLED=true
5ENV KC_METRICS_ENABLED=true
6
7# Configure a database vendor
8ENV KC_DB=postgres
9
10WORKDIR /opt/keycloak
11# for demonstration purposes only, please make sure to use proper certificates in production instead
12RUN keytool -genkeypair -storepass password -storetype PKCS12 -keyalg RSA -keysize 2048 -dname "CN=server" -alias server -ext "SAN:c=DNS:localhost,IP:127.0.0.1" -keystore conf/server.keystore
13RUN /opt/keycloak/bin/kc.sh build
14
15FROM quay.io/keycloak/keycloak:{containerlabel}
16COPY --from=builder /opt/keycloak/ /opt/keycloak/
17
18# change these values to point to a running postgres instance
19ENV KC_DB=postgres
20ENV KC_DB_URL=<DBURL>
21ENV KC_DB_USERNAME=<DBUSERNAME>
22ENV KC_DB_PASSWORD=<DBPASSWORD>
23ENV KC_HOSTNAME=localhost
24ENTRYPOINT ["/opt/keycloak/bin/kc.sh"]

Security Best Practices

When deploying Keycloak for production, make sure to replace the demonstration certificates with properly signed certificates. Also ensure that your environment provides the appropriate values for database connection parameters.

Related tools

More options with a similar category or technology profile.

Keycloak FAQs

Keycloak is listed as a Developer Tools tool on TiloBox. Review the overview, features, and official documentation on this page to decide whether it solves your specific workflow.

Start with the project's GitHub repository and official website for supported installation and deployment instructions. Test the setup with representative data or a small project before rolling it out more widely.

Keycloak is listed under the Apache-2.0 license. Read the complete license text and the project's notices before using, modifying, or distributing the software.

Production readiness depends on your requirements. Review maintenance activity, security practices, documentation, backup and upgrade procedures, and compatibility with your stack; then validate it in a non-production environment.

Keycloak is listed as an alternative to Okta. Compare the core workflow, deployment model, integrations, and licensing against your must-have requirements before switching.