Skip to content

Expose password policy provider help text in the Admin Console - #50806

Open
enoquefcd wants to merge 1 commit into
keycloak:mainfrom
enoquefcd:password-policy-helptext
Open

enoquefcd wants to merge 1 commit into
keycloak:mainfrom
enoquefcd:password-policy-helptext

Conversation

@enoquefcd

Copy link
Copy Markdown
Contributor

Closes #50805

Custom password policies show the raw message key passwordPoliciesHelp.<id> as their tooltip in Authentication → Policies, because the tooltip is resolved exclusively from translations and a policy provider has no way to supply the text itself (see the linked issue).

Changes

  • PasswordPolicyTypeRepresentation: new optional helpText field (additive, no behavior change for existing consumers).
  • ServerInfoAdminResource.setPasswordPolicies: populates helpText from ConfiguredProvider#getHelpText() when the factory implements it — the same opt-in hook setProviders already uses to build componentTypes. No SPI change.
  • keycloak-admin-client: helpText?: string; added to the TS definition.
  • Admin Console PolicyRow: the tooltip falls back to the server-provided help text when no passwordPoliciesHelp.<id> translation is defined. Precedence is otherwise unchanged: theme/realm translation, then provider help text, then the raw key (today's behavior).

Built-in policies do not implement ConfiguredProvider, so their representations and rendering are unchanged.

Tests

  • New ServerInfoPasswordPolicyTest (new test framework, CustomProvidersServerConfig) asserting that a custom policy factory implementing ConfiguredProvider exposes its help text in the server info password policies list, and that built-in policies keep a null helpText.
  • New TestConfiguredPasswordPolicyProviderFactory in tests/custom-providers.

Related

  • Add Password Policy SPI chapter to the Server Developer Guide #50804 adds a Password Policy SPI chapter to the Server Developer Guide. Its help-text section currently documents the theme-resources/messages mechanism; if this enhancement lands, that section should document ConfiguredProvider#getHelpText() as the direct option. I will update whichever of the two lands second.

AI disclosure

Generative AI (Claude) was used to assist with the implementation and this description, per the contributing guidelines. I have reviewed and understand every change and will personally address review feedback.

Copilot AI balanced review requested due to automatic review settings July 11, 2026 01:31
@enoquefcd
enoquefcd requested review from a team as code owners July 11, 2026 01:31

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds provider-supplied password-policy help text to the Admin Console while preserving translation precedence.

Changes:

  • Extends server and client representations with optional helpText.
  • Exposes ConfiguredProvider#getHelpText() and uses it as the UI fallback.
  • Adds a custom provider and integration test covering the server response.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
core/.../PasswordPolicyTypeRepresentation.java Adds the help-text property.
services/.../ServerInfoAdminResource.java Populates provider help text.
js/libs/.../passwordPolicyTypeRepresentation.ts Updates the TypeScript definition.
js/apps/.../PolicyRow.tsx Adds tooltip fallback behavior.
tests/custom-providers/.../TestConfiguredPasswordPolicyProviderFactory.java Defines the test provider.
tests/custom-providers/.../PasswordPolicyProviderFactory Registers the test provider.
tests/base/.../ServerInfoPasswordPolicyTest.java Verifies custom and built-in policy responses.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Copilot AI review requested due to automatic review settings July 23, 2026 10:58
@enoquefcd
enoquefcd force-pushed the password-policy-helptext branch from 7268ab4 to 6a2f75c Compare July 23, 2026 10:59

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings July 23, 2026 11:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.MultipleTabsLoginTest#multipleTabsParallelLoginTestWithAuthSessionExpiredAndRequiredAction

Keycloak CI - Forms IT (chrome)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.forms.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess

Keycloak CI - Base IT (5)

org.opentest4j.AssertionFailedError: expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

Copilot AI review requested due to automatic review settings August 20, 2026 16:04
@enoquefcd
enoquefcd force-pushed the password-policy-helptext branch from 6a2f75c to 215820d Compare August 20, 2026 16:04

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@enoquefcd
enoquefcd force-pushed the password-policy-helptext branch from 215820d to 1e088fe Compare August 20, 2026 16:13
Copilot AI review requested due to automatic review settings September 23, 2026 21:18
@ahus1
ahus1 force-pushed the password-policy-helptext branch from 1e088fe to b729201 Compare September 23, 2026 21:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

Empty provider help text currently produces a blank tooltip instead of the documented raw-key fallback.

Review effort: Balanced
Findings: None

The server info endpoint now includes the help text of password policy
factories that implement ConfiguredProvider, and the Admin Console falls
back to it when no passwordPoliciesHelp.<id> translation is defined.
Theme and realm translations keep precedence, built-in policies are
unaffected, and the new representation field is additive.

Closes keycloak#50805

Signed-off-by: Enoque Duarte <enoquefcd@gmail.com>
@enoquefcd
enoquefcd force-pushed the password-policy-helptext branch from b729201 to caad9b7 Compare September 25, 2026 17:54
Copilot AI review requested due to automatic review settings September 25, 2026 17:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation is focused, backward-compatible, documented, and covered by server and UI tests.

Review effort: Balanced
Findings: None

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Password policy providers cannot supply help text to the Admin Console

3 participants