Skip to content

Add support for filtering users based on organizationId - #37975

Closed
msvechla wants to merge 2 commits into
keycloak:mainfrom
msvechla:users_organization
Closed

Add support for filtering users based on organizationId#37975
msvechla wants to merge 2 commits into
keycloak:mainfrom
msvechla:users_organization

Conversation

@msvechla

@msvechla msvechla commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

This adds support for filtering users based on an organizationId.

Please let me know what you think. There might be better approaches to handles this, so I am open for some pointers on how to best solve this.

Closes #37974

Thanks a lot!

closes keycloak#37974

Signed-off-by: Marius Svechla <m.svechla@gmail.com>
closes keycloak#37974

Signed-off-by: Marius Svechla <m.svechla@gmail.com>

@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.webauthn.AppInitiatedActionWebAuthnTest#cancelSetupWebAuthn

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

org.keycloak.testsuite.webauthn.AppInitiatedActionWebAuthnTest#proceedSetupWebAuthnLogoutOtherSessionsNotChecked

Keycloak CI - WebAuthn IT (chrome)

java.lang.AssertionError: Event expected
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.junit.Assert.assertNotNull(Assert.java:713)
	at org.keycloak.testsuite.AssertEvents.poll(AssertEvents.java:95)
...

Report flaky test

@vramik

vramik commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Thanks for the contribution and for raising this, @msvechla!

I understand the need — the organizations members endpoint currently doesn't offer the same rich filtering
capabilities as the users endpoint, which makes it harder to work with organization members at scale.

That said, I don't think adding organization-aware filters to the users endpoints is the direction we want to go.
We'd prefer to keep organization concerns within the organization API itself, rather than spreading them across
users endpoints.

The right path forward is enhancing the organization endpoints (e.g., GET
/admin/realms/{realm}/organizations/{org-id}/members) with the filtering and search capabilities that are currently
missing. I see that #38090 is already heading in that direction, which is great.

@vramik vramik closed this Mar 19, 2026
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.

Allow to filter users by organization

2 participants