Configure Keycloak authentication methods
What you’ll accomplish
Section titled “What you’ll accomplish”You’ll enable or disable the authentication methods available on the UDS Core login page — including username/password, X.509/CAC certificates, WebAuthn, OTP, and social login — using bundle overrides. No image rebuild is required.
Prerequisites
Section titled “Prerequisites”- UDS Core deployed
- UDS CLI installed
Before you begin
Section titled “Before you begin”UDS Core ships with all major authentication flows enabled by default. Use realmAuthFlows bundle overrides to selectively enable or disable them for your environment.
| Setting | Default | Description |
|---|---|---|
USERNAME_PASSWORD_AUTH_ENABLED | true | Username/password login, password reset, and registration |
X509_AUTH_ENABLED | true | X.509 certificate (CAC/PIV) authentication |
SOCIAL_AUTH_ENABLED | true | Social/SSO login (Google, Azure AD, etc.) — requires an IdP to also be configured |
OTP_ENABLED | true | One-time password (TOTP) as a required MFA step for username/password login |
WEBAUTHN_ENABLED | false | WebAuthn/passkey as a required MFA step for username/password login |
X509_MFA_ENABLED | false | Require additional MFA (OTP or WebAuthn) after X.509 authentication |
-
Determine which flows to enable
Identify which authentication methods your environment requires. Common configurations:
Environment Recommended configuration CAC-only (no username/password) Disable USERNAME_PASSWORD_AUTH_ENABLED, keepX509_AUTH_ENABLEDUsername/password + OTP only Keep defaults, disable X509_AUTH_ENABLEDandSOCIAL_AUTH_ENABLEDUsername/password + WebAuthn Enable WEBAUTHN_ENABLED, disableOTP_ENABLEDif desiredCAC + MFA Enable X509_MFA_ENABLED(also requiresOTP_ENABLEDorWEBAUTHN_ENABLED) -
Add
realmAuthFlowsto your bundle overrideIn your
uds-bundle.yaml, set the desired authentication flow values:uds-bundle.yaml packages:- name: corerepository: registry.defenseunicorns.com/public/coreref: x.x.x-upstreamoverrides:keycloak:keycloak:values:- path: realmAuthFlowsvalue:USERNAME_PASSWORD_AUTH_ENABLED: trueX509_AUTH_ENABLED: falseSOCIAL_AUTH_ENABLED: falseOTP_ENABLED: trueWEBAUTHN_ENABLED: falseX509_MFA_ENABLED: falseFor clarity and auditability, specifying all settings explicitly is recommended — even settings you are leaving at their defaults.
-
Create and deploy your bundle
Terminal window uds create <path-to-bundle-dir>uds deploy uds-bundle-<name>-<arch>-<version>.tar.zst
Verification
Section titled “Verification”Confirm authentication flow changes are applied:
- Navigate to
sso.<domain> - Confirm only the expected login options appear on the login page
- For X.509/CAC: confirm the browser prompts for a client certificate (requires truststore to be configured and a valid certificate installed)
Check Keycloak authentication flow configuration:
In the Keycloak admin UI, navigate to keycloak.<admin_domain> → uds realm → Authentication → Flows and confirm the expected flow steps are enabled or disabled.
Troubleshooting
Section titled “Troubleshooting”Problem: Login page still shows disabled authentication options after deploy
Section titled “Problem: Login page still shows disabled authentication options after deploy”Symptoms: The login page displays username/password or CAC fields even though they were disabled.
Solution: realmAuthFlows values are applied during initial realm import only. If Keycloak was already running before the override was applied, Keycloak must be fully torn down and redeployed so the realm is re-imported:
uds create <path-to-bundle-dir>uds deploy uds-bundle-<name>-<arch>-<version>.tar.zstIf redeploying is not possible, configure the flows manually in the Keycloak Admin Console at keycloak.<admin_domain> → uds realm:
| Flow setting | Admin UI path |
|---|---|
| Disable username/password | Authentication → Flows → UDS Authentication → disable the Deny Access step below Username Password Form |
| Disable credential reset | Authentication → Flows → UDS Reset Credentials → disable the Reset Password step |
| Disable user registration | Authentication → Flows → UDS Registration → disable the UDS Registration form step |
| Enable/disable OTP | Authentication → Required Actions tab → toggle Configure OTP |
| Enable WebAuthn | 1. Authentication → Required Actions → toggle on Webauthn Register Passwordless under the Enabled column 2. Authentication → Flows → UDS Authentication → set the MFA sub-flow to Required 3. Inside the MFA sub-flow, set WebAuthn Passwordless Authenticator to Required |
Problem: X.509/CAC login fails with OCSP error in airgapped environment
Section titled “Problem: X.509/CAC login fails with OCSP error in airgapped environment”Symptoms: Certificate authentication fails with an OCSP revocation check error. Logs show the OCSP responder is unreachable.
Solution: Configure OCSP fail-open behavior or disable OCSP checking via realmInitEnv.
To allow authentication when the OCSP responder is unreachable (fail-open):
- path: realmInitEnv value: X509_OCSP_FAIL_OPEN: "true"To disable OCSP checking entirely:
- path: realmInitEnv value: X509_OCSP_CHECKING_ENABLED: "false"If your environment uses CRL-based revocation instead of OCSP, configure the CRL path:
- path: realmInitEnv value: X509_CRL_CHECKING_ENABLED: "true" X509_CRL_RELATIVE_PATH: "crls/DODROOTCA3.crl##crls/DODIDCA_81.crl" # Relative to /opt/keycloak/conf; use ## between multiple paths X509_CRL_ABORT_IF_NON_UPDATED: "false" # Set true to fail authentication if CRL is expiredProblem: MFA is not required after enabling WebAuthn or OTP
Section titled “Problem: MFA is not required after enabling WebAuthn or OTP”Symptoms: Users can log in without completing an MFA step.
Solution: Confirm that both the flow toggle and at least one MFA method are enabled. For WebAuthn to work as a required step, WEBAUTHN_ENABLED: true must be set; for OTP, OTP_ENABLED: true. Verify the realm was redeployed after the override was applied.
Reference: X.509/CAC with additional MFA
Section titled “Reference: X.509/CAC with additional MFA”If you do need to require an additional factor after CAC authentication, use this configuration in the realmAuthFlows block from step 2 in place of the values shown there, then recreate and deploy the bundle:
- path: realmAuthFlows value: X509_AUTH_ENABLED: true X509_MFA_ENABLED: true OTP_ENABLED: true # At least one MFA method must also be enabled WEBAUTHN_ENABLED: falseX509_MFA_ENABLED: true has no effect unless at least one of OTP_ENABLED or WEBAUTHN_ENABLED is also enabled.
Related Documentation
Section titled “Related Documentation”- Keycloak: Authentication — upstream reference for Keycloak authentication flow configuration
Next steps
Section titled “Next steps”These guides and concepts may be useful to explore next: