Skip to content
Unified Defense StackUnified Defense Stack

Configure Keycloak authentication methods

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.

  • UDS Core deployed
  • UDS CLI installed
  • UDS Registry account created and authenticated locally with a read token

UDS Core ships with all major authentication flows enabled by default. Use realmAuthFlows bundle overrides to selectively enable or disable them for your environment.

SettingDefaultDescription
USERNAME_PASSWORD_AUTH_ENABLEDtrueUsername/password login, password reset, and registration
X509_AUTH_ENABLEDtrueX.509 certificate (CAC/PIV) authentication
SOCIAL_AUTH_ENABLEDtrueSocial/SSO login (Google, Azure AD, etc.); requires an IdP to also be configured
OTP_ENABLEDtrueOne-time password (TOTP) as a required MFA step for username/password login
WEBAUTHN_ENABLEDfalseWebAuthn/passkey as a required MFA step for username/password login
X509_MFA_ENABLEDfalseRequire additional MFA (OTP or WebAuthn) after X.509 authentication
  1. Determine which flows to enable

    Identify which authentication methods your environment requires. Common configurations:

    EnvironmentRecommended configuration
    CAC-only (no username/password)Disable USERNAME_PASSWORD_AUTH_ENABLED, keep X509_AUTH_ENABLED
    Username/password + OTP onlyKeep defaults, disable X509_AUTH_ENABLED and SOCIAL_AUTH_ENABLED
    Username/password + WebAuthnEnable WEBAUTHN_ENABLED, disable OTP_ENABLED if desired
    CAC + MFAEnable X509_MFA_ENABLED (also requires OTP_ENABLED or WEBAUTHN_ENABLED)
  2. Add realmAuthFlows to your bundle override

    In your uds-bundle.yaml, set the desired authentication flow values:

    uds-bundle.yaml
    packages:
    - name: core
    repository: registry.defenseunicorns.com/public/core
    ref: x.x.x-upstream
    overrides:
    keycloak:
    keycloak:
    values:
    - path: realmAuthFlows
    value:
    USERNAME_PASSWORD_AUTH_ENABLED: true
    X509_AUTH_ENABLED: false
    SOCIAL_AUTH_ENABLED: false
    OTP_ENABLED: true
    WEBAUTHN_ENABLED: false
    X509_MFA_ENABLED: false

    For clarity and auditability, specifying all settings explicitly is recommended, even settings you are leaving at their defaults.

  3. Create and deploy your bundle

    Terminal window
    uds create <path-to-bundle-dir>
    uds deploy uds-bundle-<name>-<arch>-<version>.tar.zst
  4. (Optional) Update realm flows on an existing deployment

    If the Keycloak realm was already imported, a new realmAuthFlows value does not update its realm flows. Manually update the uds realm in the Keycloak Admin Console at keycloak.<admin_domain>. Apply the tab for each primary method or optional MFA method you need to update. For example, to keep only Social/SSO after deploying X.509/CAC and Social/SSO, apply the X.509/CAC tab.

    For USERNAME_PASSWORD_AUTH_ENABLED: false:

    1. Open AuthenticationFlowsUDS Authentication.
    2. Expand Username Password Form.
    3. Set Deny Access to Required.
    4. Open AuthenticationFlowsUDS Reset Credentials and disable Reset Password.
    5. Open AuthenticationFlowsUDS Registration. Leave UDS Registration form enabled if X.509/CAC remains enabled. If X.509/CAC is also disabled, disable UDS Registration form.

Confirm authentication flow changes are applied:

  1. Navigate to sso.<domain>
  2. Confirm only the expected login options appear on the login page
  3. 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 → AuthenticationFlows and confirm the expected flow steps are enabled or disabled.

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 expired

Problem: 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.

If redeploying is not possible, use the corresponding OTP or WebAuthn tab in Step 4.

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: false

X509_MFA_ENABLED: true has no effect unless at least one of OTP_ENABLED or WEBAUTHN_ENABLED is also enabled.