mTLS Certificates and CRL Agent on Keycloak β

What are mTLS and CRL in Keycloak? β
mTLS (Mutual TLS) is a security protocol where both the client and the server authenticate using certificates. Unlike standard TLSβwhere only the server proves its identityβmTLS ensures that only trusted applications, services, or devices can reach Keycloak. This adds a strong validation layer before any authentication flow begins.
CRL (Certificate Revocation List) is a list of certificates that should no longer be trusted because they were compromised, disabled, or removed from use. Keycloakβs CRL Agent regularly retrieves and updates these lists from your PKI. During the mTLS handshake, it checks whether the presented certificate is valid or revoked. If the certificate appears in the CRL, Keycloak immediately blocks the connection.
Together, mTLS + CRL ensure that only verified and non-revoked clients can communicate with Keycloak.
Usage and Use Cases of mTLS in Keycloak β
mTLS adds a strong security layer to Keycloak by validating the client certificate before any access is allowed. By enforcing the βSomething You Haveβ factor through a device-bound certificate, mTLS can even replace username/password login entirely when configured in strict mode.
Beyond stronger security, mTLS also simplifies onboarding new applications or APIs: instead of configuring passwords or shared secrets, access is granted through certificate-based trust, offering a safer and more scalable alternative.
IAM Use Cases β
CIAM (Customer IAM) β
- Restrict access to trusted customer applications
- Block spoofed or malicious apps early
- Reduce fraud and protect customer accounts
WIAM (Workforce IAM) β
- Allow access only from managed corporate devices
- Protect internal and administrative applications
- Reduce insider risks and unauthorized surface exposure
Identity Provider Brokering β
- Authenticate external IdPs using certificates
- Prevent spoofed IdPs and man-in-the-middle attacks
- Strengthen cross-domain trust relationships
Technical Use Cases β
- Microservices / M2M: Secure internal API and service-to-service calls
- Admin Tools & Automation: Authenticate scripts or admin tools without passwords
Security considerations and user impact of mTLS β
While mTLS significantly improves security, it also introduces friction for end users and client applications (e.g.: losing a certificate means losing access, users cannot authenticate from unmanaged devices, IT teams must generate and distribute certificates, etc.).
These constraints reflect the usual balance between stronger security and operational convenience, the appropriate level depends on each organizationβs context and security requirements.
How to upload your mTLS certificates in the Cloud-IAM Console β
In this article, we will assume that you already created your certificate .crt .cer.
- Open Cloud-IAM console
- Select the Keycloak deployment you want to configure.
- Click on
Customisation - Then select
mTLSto start the configuration - Click
Upload - Select the file containing your certificate (for example: acme-v1.0.crt)
- Toggle the option to either apply now and trigger a restart or don't and upload now and restart later.
- Then click
Uploadto confirm
After 5β10 minutes, while your Keycloak deployment redeploys via the rolling upgrade process, the changes will be applied. Your mTLS certificates are now uploaded to your deployment.

How to configure Strict mTLS for Keycloak β
Introduction β
This tutorial explains how to configure strict mTLS for your Keycloak deployment. In a strict mTLS setup, every client must present a valid X.509 certificate before accessing Keycloak.
This mode is useful when:
- You want to enforce strong authentication for all clients
- Your environment requires strict verification of device or application identity
- You must block all unauthenticated connections at the network edge
- You want to prevent access from unmanaged or unknown devices entirely
Identity Mapping Assumption β
For this tutorial, we assume that your client certificate contains an email field (either in the Subject or in the Subject Alternative Name β SAN). This email allows Keycloak to map the incoming certificate to the correct user account during authentication.
Login behavior with strict mTLS β
If the client does not send a certificate, or if the certificate is invalid, the connection is blocked directly at the load balancer, before it reaches Keycloak. If the certificate is valid, the load balancer approves the connection and forwards the request to Keycloak for identity mapping and authentication. For more details on how a Managed Keycloak deployment architecture with Load Balancer and Keycloak, see the architecture insight.
This guide assumes β
- You have already uploaded your mTLS certificate in the Cloud-IAM Console.
β See: How to upload your mTLS certificates - You are using a custom domain, which is required to enable mTLS on managed deployments.
β See: How to configure your custom domain - Your Keycloak deployment is fully operational and shows the Running status.
β See: Deployment lifecycle β Running
Scope of This Tutorial β
This tutorial focuses on how to configure optional mTLS within Keycloak and the Cloud-IAM Console. This tutorial does not cover all the necessary security best practices for a complete configuration, it's a build to guide you through one specific process.
Step 1 - How to set a custom domain with mTLS as Strict β
In this step, you configure your custom domain so it enforces strict mTLS at the load balancer level. This ensures Keycloak only receives requests from clients presenting a valid certificate.
- Open Cloud-IAM console
- Select the Keycloak deployment you want to configure.
- Click on
Configuration - Select the
β Editicon next to the custom domain you want to secure with strict mTLS. - Enable the
mTLS toggle. - Select
Strict, then clickSaveto confirm.

Step 2 - How to duplicate your browser flow on Keycloak β
Keycloak does not allow editing the default Browser flow, so you must duplicate the browser flow before making changes.
- Log in to your Keycloak as an admin
- Select the realm where you want to apply mTLS certifications
- Navigate to
Authentication - Select
...from theBrowserline - Click on
Duplicate(3.) - Name the new browser flow (e.g. browser-mtls)

Step 3 - How to add steps mTLS on Keycloak authentication flow β
In this step, you add the X.509 authenticator so Keycloak can extract the email from the certificate and identify the user.
- Open the newly created Browser flow (e.g. browser-mtls)
- Select
Add Execution - Search from the list X509/Validate Username Form, select it, and click
Add - Reorder the executions so X509/Validate Username Form is placed just below the Cookie and above Kerberos step
- Set the execution requirement to
Required

Step 4 - How to configure mTLS x509 on Keycloak authentication flow as strict β
In this step, you configure Keycloak to extract the email from the certificate and map it to the correct Keycloak user.
- Select the βοΈ next to X509/Validate Username Form to open the control panel
- Name X509/Validate Username Form config on Alias (e.g. mtls-email)
- From User Identity Source list click on
Subject's e-mail - From User mapping method list click on
Username or Email - Optional: if you don't want confirmation screen toggle On Bypass identity confirmation line
- Verify the toggle is ON that Check certificate validity
- Then click
Saveto validate this new execution

Step 5 - How to bind the new mTLS browser flow β
In this step, you activate your new authentication flow so it becomes the default browser flow for the realm.
- Navigate to
Authentication - Select
...from thebrowser-mtlsline - Click on
Bind flow - Then select Browser flow and click on Save
Your Keycloak realm now uses the mTLS-enabled flow.

Conclusion β
You have now successfully enabled strict mTLS authentication for Keycloak on your realm. All incoming connections must now present a valid certificate, and Keycloak will authenticate users based on the email contained in that certificate.
How to configure Optional mTLS for Keycloak β
Introduction β
This tutorial explains how to configure optional mTLS for your Keycloak deployment. In an optional mTLS setup, clients may present a valid X.509 certificate, but it is not required to access Keycloak or the application behind.
This mode is useful when:
- You want to gradually roll out mTLS without breaking existing access
- Your environment mixes managed devices (with certificates) and unmanaged ones
- You need strong authentication when possible, while allowing standard login flows for the rest
Identity Mapping Assumption β
For this tutorial, we assume that your client certificate contains an email field (either in the Subject or in the Subject Alternative Name β SAN). This email allows Keycloak to map the incoming certificate to the correct user account during authentication.
Login behavior with optional mTLS β
If the client sends a valid certificate, the load balancer validates it and forwards the request to Keycloak. Keycloak then authenticates the user using the email extracted from the certificate. If the client does not send a certificate, or sends an invalid certificate, the load balancer still forwards the request to Keycloak. Keycloak then continues with the regular login flow (username/password, identity provider redirect, etc.).
This allows your deployment to support heterogeneous environments with different levels of security. For more details on how a Managed Keycloak deployment architecture with Load Balancer and Keycloak, see the architecture insight.
This guide assumes β
- You have already uploaded your mTLS certificate in the Cloud-IAM Console.
β See: How to upload your mTLS certificates - You are using a custom domain, which is required to enable mTLS on managed deployments.
β See: How to configure your custom domain - Your Keycloak deployment is fully operational and shows the Running status.
β See: Deployment lifecycle β Running
Scope of This Tutorial β
This tutorial focuses on how to configure optional mTLS within Keycloak and the Cloud-IAM Console. This tutorial does not cover all the necessary security best practices for a complete configuration, it's a build to guide you through one specific process.
Step 1 - How to set a custom domain with mTLS as Optional β
In this step, you configure your custom domain so it enforces optional mTLS at the load balancer level. This ensures Keycloak only receives all requests from clients.
- Open Cloud-IAM console
- Select the Keycloak deployment you want to configure.
- Click on
Configuration - Select the
β Editicon next to the custom domain you want to secure with optional mTLS. - Enable the
mTLS toggle. - Select
Optional, then clickSaveto confirm.

Step 2 - How to duplicate your browser flow on Keycloak β
Please refer to Step 2 of strict mTLS tutorial.
Step 3 - How to add steps mTLS on Keycloak authentication flow β
In this step, you add the X.509 authenticator so Keycloak can extract the email from the certificate and identify the user if he has one.
- Open the newly created Browser flow (e.g. browser-mtls)
- Select
Add Execution - Search from the list X509/Validate Username Form, select it, and click
Add - Reorder the executions so X509/Validate Username Form is placed just below the Cookie and above Kerberos step
- Set the execution requirement to
alternative

Step 4 - How to configure mTLS x509 on Keycloak authentication flow as optional β
Please refer to Step 4 of strict mTLS tutorial.
Step 5 - How to bind the new mTLS browser flow β
Please refer to Step 5 of strict mTLS tutorial.
Conclusion β
You have now successfully enabled optional mTLS authentication for Keycloak on your realm. This mode provides the benefits of certificate-based authentication only when certificates are available, while still supporting standard login methods for users, applications, or devices that do not use mTLS yet.
How to manage the CRL Agent List β
This feature is currently under active development and is not yet available through the Cloud-IAM Console.
If you need to configure or update your CRL Agent list, please contact our support team. Our engineers will assist to apply the configuration on your Keycloak deployment.