8000 Add admin REST endpoints to list a user's identity provider links by sguilhen · Pull Request #54617 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content

Add admin REST endpoints to list a user's identity provider links - #54617

Open
sguilhen wants to merge 2 commits into
keycloak:mainfrom
sguilhen:52482-admin-idp-links
Open

sguilhen wants to merge 2 commits into
keycloak:mainfrom
sguilhen:52482-admin-idp-links

Conversation

@sguilhen
@sguilhen sguilhen commented Nov 4, 2026
Copy link
Copy Markdown
Contributor

Closes #52482

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.

🟡 Changes recommended

Single-character searches such as * or a double quote crash the linked-provider listing because delimiter stripping lacks a minimum-length check.

1 open issue
What changed in this PR

Addresses #52482 by adding a user-specific identity-provider links endpoint, so the Admin UI no longer relies on the first page of realm providers to resolve linked accounts.

Changes:

  • Adds linked and available provider listings with provider metadata, search, and pagination.
  • Exposes the endpoint through Java and TypeScript admin clients and updates the Admin UI.
  • Adds tests for linking behavior and providers beyond the default page size.
File Description
tests/​base/​src/​test/​java/​org/​keycloak/​tests/​admin/​user/​UserFedarationTest.java Tests linked and available providers, including pagination regression coverage.
services/​src/​main/​java/​org/​keycloak/​services/​resources/​admin/​UserResource.java Implements the links endpoint, filtering, permissions, and metadata resolution.
js/​libs/​keycloak-admin-client/​src/​resources/​users.ts Adds the TypeScript client method.
js/​libs/​keycloak-admin-client/​src/​defs/​federatedIdentityLinkRepresentation.ts Defines the enriched link response type.
js/​apps/​admin-ui/​src/​user/​UserIdentityProviderLinks.tsx Uses the endpoint for provider tables and type badges.
integration/​admin-client-core/​src/​main/​java/​org/​keycloak/​admin/​client/​resource/​UserResource.java Adds the Java client method.
core/​src/​main/​java/​org/​keycloak/​representations/​idm/​FederatedIdentityLinkRepresentation.java Adds the shared response representation with provider metadata.

Review effort: Balanced

@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from ce827fc to 79d10c7 Compare November 4, 2026 16:07
Copilot AI balanced review requested due to automatic review settings November 4, 2026 16:07
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.

🟡 Changes recommended

Search filtering has inconsistent case sensitivity between linked and available providers, and a lone-quote search with linked=false can trigger an HTTP 500.

2 open issues
1 resolved since last review

Review effort: Balanced

@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.actions.TermsAndConditionsTest#termsAccepted

Keycloak CI - Forms IT (firefox)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:160)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:344)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:48)
...

Report flaky test

org.keycloak.testsuite.actions.TermsAndConditionsTest#termsDeclinedAccount

Keycloak CI - Forms IT (firefox)

java.lang.RuntimeException: Could not create statement
	at org.jboss.arquillian.junit.Arquillian.methodBlock(Arquillian.java:307)
	at org.jboss.arquillian.junit.Arquillian$2.evaluate(Arquillian.java:160)
	at org.jboss.arquillian.junit.Arquillian.multiExecute(Arquillian.java:344)
	at org.jboss.arquillian.junit.Arquillian.access$200(Arquillian.java:48)
...

Report flaky test

@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from 79d10c7 to 12da748 Compare November 4, 2026 17:06
Copilot AI balanced review requested due to automatic review settings November 4, 2026 17:06
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.

🟢 Approval recommended

No active review issues are recorded for the changes that return identity-provider metadata with user links.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from 12da748 to 03008f7 Compare November 6, 2026 13:49
Copilot AI balanced review requested due to automatic review settings November 6, 2026 13:49
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.

🟡 Changes recommended

Available-provider filtering ignores resolved display names, so searching for a returned name such as "GitHub" can yield no results and behaves inconsistently with linked-provider searches.

1 open issue

Review effort: Balanced

@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from 03008f7 to b37d60a Compare November 6, 2026 14:31
Copilot AI balanced review requested due to automatic review settings November 6, 2026 14: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.

🟡 Changes recommended

A non-matching paginated search resolves every eligible identity provider, causing database work to scale with the entire realm rather than the requested page size.

1 open issue
1 resolved since last review

Review effort: Balanced

@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from b37d60a to 0606850 Compare November 6, 2026 15:08
Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:08
@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from 0606850 to 20a6d9c Compare November 6, 2026 15:11
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.

🟡 Changes recommended

Quoted searches use case-insensitive equality for available providers but case-sensitive equality after linking, causing inconsistent results for providers without a configured display name.

1 open issue
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 6, 2026 15:12
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.

🔵 Needs a closer look

Quoted searches use case-insensitive matching for available providers but case-sensitive matching after linking, causing inconsistent results for providers without a configured display name.

1 open issue

Review effort: Balanced

- add GET /admin/realms/{realm}/users/{id}/federated-identity-links,
mirroring the approach already used by the account console's
linked-accounts endpoint

Closes keycloak#52482

Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
Signed-off-by: Stefan Guilhen <sguilhen@redhat.com>
@sguilhen
sguilhen force-pushed the 52482-admin-idp-links branch from 20a6d9c to 8d41d0f Compare November 6, 2026 17:14
Copilot AI balanced review requested due to automatic review settings November 6, 2026 17:14
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.

🟡 Changes recommended

Default-locale lowercasing causes resolved-display-name searches for unlinked providers to fail on Turkish JVMs, unlike the linked-provider branch that uses Locale.ROOT.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment on lines +608 to +611
matches = (name, t) -> name.toLowerCase().contains(t.toLowerCase());
} else {
term = search.endsWith("*") ? search.substring(0, search.length() - 1) : search;
matches = (name, t) -> name.toLowerCase().startsWith(t.toLowerCase());
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.

Missing :providerId param in Identity Provider Links page when linked IdP is not included in first paginated /identity-provider/instances response

2 participants

0