Link authentication flow UsedBy clients to client settings - #48841
Conversation
95a32b1 to
2cd8e8e
Compare
edewit
left a comment
There was a problem hiding this comment.
This introduces a lot of queries, it would be better to change the endpoint to return the uuid and the clientId.
|
Pushed ec66b12: ui-ext /flows now includes clientRefs (internal id + clientId) for SPECIFIC_CLIENTS, and the paginated authentication-management used-by clients response returns the same object shape so UsedBy.tsx no longer calls clients.find per row. I did not run mvn here because JAVA_HOME is not set on the agent. |
|
@edewit On current head the realm authentication table already gets |
|
Visibility ping: ready to address comments whenever reviewers post them. |
|
HEAD ec66b12 already extends UsedBy payloads with clientRefs (realm uuid + clientId) per your 2026-05-11 note (clients.find resolution removed from UsedBy.tsx). CHANGES_REQUESTED still pins 2cd8e8e; can you dismiss or approve on ec66b12? (@edewit**) |
|
Typo repair: tagging @edewit explicitly for visibility on **ec66b12. |
|
I checked the current head and it now returns uuid and clientId without the earlier query fan-out. That matches the review request, so I am asking for another pass on the branch as it stands now. |
|
@singhvishalkr it's got a build error: |
ec66b12 to
dbc79e4
Compare
|
Updated the branch. The popover path now normalizes |
|
Current head already returns UsedByClientRef objects from the backend, carries clientRefs through usedBy, and uses |
|
@singhvishalkr there another build issue |
|
Updated the branch. The Admin UI failure was Prettier on Validated with:
I also tried |
There was a problem hiding this comment.
Pull request overview
Adds linkable client references to the “Used by” hints for authentication flows in the Admin UI, enabling direct navigation to a client’s settings page by using the internal client UUID.
Changes:
- Introduces a
UsedByClientRefDTO and extendsUsedByto optionally includeclientRefsforSPECIFIC_CLIENTS. - Updates backend mapping and the
authentication-management/{type}/{id}endpoint to return{ id, clientId }objects instead of plain strings. - Updates the Admin UI to render client entries as links (when an internal id is available) in both the popover and the modal.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/UsedByClientRef.java | New DTO to carry internal client id + clientId label. |
| rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/UsedBy.java | Adds optional clientRefs field for linkable client references. |
| rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/model/AuthenticationMapper.java | Populates clientRefs for SPECIFIC_CLIENTS used-by info. |
| rest/admin-ui-ext/src/main/java/org/keycloak/admin/ui/rest/AuthenticationManagementResource.java | Changes “list used-by” endpoint to return UsedByClientRef objects (clients + idp). |
| js/apps/admin-ui/src/components/role-mapping/resource.ts | Updates fetchUsedBy() return type to UsedByClientRef[]. |
| js/apps/admin-ui/src/authentication/constants.ts | Extends AuthenticationType.usedBy to include optional clientRefs. |
| js/apps/admin-ui/src/authentication/components/UsedBy.tsx | Renders linkable client entries in popover + modal using internal client id. |
| .map(c -> new UsedByClientRef(c.getId(), c.getClientId())).filter(ref -> ref.getClientId().contains(search)) | ||
| .skip("".equals(search) ? first : 0).limit(max).collect(Collectors.toList()); |
| if ("idp".equals(type)) { | ||
| return session.identityProviders().getByFlow(flow.getId(), search, first, max).toList(); | ||
| return session.identityProviders().getByFlow(flow.getId(), search, first, max) | ||
| .map(alias -> new UsedByClientRef(null, alias)).collect(Collectors.toList()); |
| const clientRefs = usedBy?.clientRefs; | ||
| const clientsOrFallback: FlowUsedByRow[] = useMemo(() => { | ||
| if (!usedBy || usedBy.type !== "SPECIFIC_CLIENTS") { | ||
| return []; | ||
| } | ||
| if (clientRefs && clientRefs.length > 0) { | ||
| return clientRefs; | ||
| } | ||
| return usedBy.values.map((clientId) => ({ clientId })); | ||
| }, [usedBy, clientRefs]); |
|
Updated the branch for the latest review comments. Changes made:
Validated with:
|
96987c3 to
bdb2294
Compare
…ings Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
…rnal ids Extend ui-ext /flows UsedBy for SPECIFIC_CLIENTS with clientRefs (realm internal id plus clientId). Return the same shape from paginated authentication-management used-by clients rows. Drop clients.find resolution from UsedBy.tsx. Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
Signed-off-by: Vishal Kumar Singh <vishal.kr.singh2021@gmail.com>
bdb2294 to
85fc9da
Compare
Unreported flaky test detectedIf 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.BrowserFlowTest#testUserWithOneAdditionalFactorOtpSuccess |
Closes #40211.
Problem:
The authentication flows table can show which clients override a flow, but the Admin UI only had the clientId label and could not link directly to the client settings page.
Root cause:
The existing used-by payload exposed display labels but not the internal client UUID required by the client settings route.
Solution:
{ id, label }rows from the paginated used-by endpoint so both client and identity-provider results have a clear contract.skip(first)after filtering client rows.Verification:
corepack pnpm exec prettier --check apps/admin-ui/src/authentication/components/UsedBy.tsx apps/admin-ui/src/components/role-mapping/resource.tscorepack pnpm --filter @keycloak/keycloak-admin-ui build.\mvnw.cmd -pl rest/admin-ui-ext -am -DskipTests -DskipITs compilegit diff --check