r/KeyCloak • • Sep 25 '26

Disabled User Message

I have a realm where users use x509 authentication to sign in..When a user gets disabled I would like to customize the message that they see. Currently it just shows "X509 certificate authentication's failed. User is disabled."

In the messages_en.properties file i have tried setting the accountDisabledMessage field and this does not seem to change this message at all for me.

Anyone know how to target this field while using x509 authentication?

TIA

2 Upvotes

4 comments sorted by

3

u/AVIAIT Sep 25 '26

"X509 certificate authentication's failed." and "User is disabled" are composed inside the X.509 authenticator itself (org.keycloak.authentication.authenticators.x509.X509ClientCertificateAuthenticator / ValidateX509CertificateUsername in keycloak-services). accountDisabledMessage belongs to the username/password path, which is exactly why it has no effect here. In the base login theme the only X.509-related keys are doX509Login, clientCertificate, noCertificate, auth-x509-client-username-form-display-name and ...-help-text — there is no error-text key to override.

So you have two realistic options:

  1. A small custom authenticator that extends/replaces the X.509 one and fails with your own message key — then it stays localizable. This is the proper fix.
  2. Or catch it before the certificate step: add an earlier step that checks user.isEnabled() and fails with your message. Note that if the X.509 execution is still reached, it will print its own text anyway.

There's no config-only override for this (verified on 26.7.4). Probably worth filing an issue upstream.

1

u/freddyp91 Sep 28 '26

Thank you for the response! Sounds like i'll be going with option 1 then.
I'll go ahead and file an issue upstream as well.

1

u/freddyp91 Sep 29 '26

Update. Went with option 1 here and it worked like a charm.

1

u/triflingconcern Sep 29 '26

It actually doesn't look like that that one uses a properties value at all: https://github.com/keycloak/keycloak/blob/319d7c205add3606af5574c76980bc7a8a2c486f/services/src/main/java/org/keycloak/authentication/authenticators/x509/X509ClientCertificateAuthenticator.java#L135

It might be straightforward to put up a pull request for that, but in the interim you you could add a bit of custom JS in the theme to swap out that content. A bit hacky, I know.