Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[client-v2] Create tests for checking permissions#45981

Merged
vmuzikar merged 3 commits intokeycloak:mainfrom
mabartos:KC-45975
Feb 11, 2026
Merged

[client-v2] Create tests for checking permissions#45981
vmuzikar merged 3 commits intokeycloak:mainfrom
mabartos:KC-45975

Conversation

@mabartos
Copy link
Contributor

@mabartos mabartos commented Feb 3, 2026

@mabartos mabartos self-assigned this Feb 3, 2026
@mabartos mabartos added the team/admin-api-wg Admin API v2 Working Group label Feb 3, 2026
@mabartos mabartos force-pushed the KC-45975 branch 2 times, most recently from 1a53fba to dbd3e59 Compare February 3, 2026 16:30
Copy link

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

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

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.BruteForceTest#testExceedMaxTemporaryLockouts

Keycloak CI - Forms IT (chrome)

java.lang.AssertionError: Expected LoginPage but was localhost (https://localhost:8543/auth/realms/test/login-actions/authenticate?session_code=sipWuEgKejzoW8sX60hjeRDwmlx-sW21N8Q-5SHzQ-w&execution=1776db0f-31b7-466b-a962-fb2d35b1cdda&client_id=test-app&tab_id=cFHeQQcMj1Q&client_data=eyJydSI6Imh0dHBzOi8vbG9jYWxob3N0Ojg1NDMvYXV0aC9yZWFsbXMvbWFzdGVyL2FwcC9hdXRoIiwicnQiOiJjb2RlIn0)
	at org.junit.Assert.fail(Assert.java:89)
	at org.junit.Assert.assertTrue(Assert.java:42)
	at org.keycloak.testsuite.pages.AbstractPage.assertCurrent(AbstractPage.java:39)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
...

Report flaky test

@mabartos mabartos marked this pull request as ready for review February 4, 2026 11:48
@mabartos mabartos requested review from a team as code owners February 4, 2026 11:48
@mabartos mabartos force-pushed the KC-45975 branch 5 times, most recently from 62e432e to 8b8892a Compare February 4, 2026 13:14
@mabartos
Copy link
Contributor Author

mabartos commented Feb 4, 2026

@edewit @keycloak/cloud-native Could you please check it? Thanks!

shawkins
shawkins previously approved these changes Feb 4, 2026
Copy link
Contributor

@shawkins shawkins left a comment

Choose a reason for hiding this comment

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

This looks great, thank you @mabartos

Related to this once we have the layers separated I would wonder if we could introduce a v1 to v2 shim to run all the existing v1 test cases against v2 to make sure we have accounted for all the differences.

@mabartos
Copy link
Contributor Author

mabartos commented Feb 4, 2026

Related to this once we have the layers separated I would wonder if we could introduce a v1 to v2 shim to run all the existing v1 test cases against v2 to make sure we have accounted for all the differences.

@shawkins Thanks. +1 Yep, once it's doable, I think it'd be very good to do it to increase our confidence with the V2.

@vmuzikar vmuzikar self-requested a review February 4, 2026 17:28
Copy link
Contributor

@edewit edewit left a comment

Choose a reason for hiding this comment

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

👍

@mabartos
Copy link
Contributor Author

mabartos commented Feb 5, 2026

@vmuzikar I saw that you requested a review for yourself. Do you plan to look at it?

@vmuzikar
Copy link
Contributor

vmuzikar commented Feb 5, 2026

@mabartos Yes, I'd like to take a look tomorrow.

Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

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

@mabartos Thank you for the PR. I think it's a good start.

Comment on lines 79 to 81
@InjectAdminClient(ref = "manageRealmAdminClient", client = "test-client", user = "manage-realm-admin",
mode = InjectAdminClient.Mode.MANAGED_REALM)
Keycloak manageRealmAdminClient;
Copy link
Contributor

Choose a reason for hiding this comment

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

In general, we're missing manage-realm role from almost all test but that should be fine as it's a role essentially unrelated to clients.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vmuzikar We can think about potential other test cases later if it works to you.

Copy link
Contributor

Choose a reason for hiding this comment

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

We're missing some tests for FGAP. Permissions can be on per-client basis. But I'd be ok with doing it as a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we can do it in a follow-up.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Signed-off-by: Martin Bartoš <[email protected]>
@mabartos
Copy link
Contributor Author

mabartos commented Feb 9, 2026

@vmuzikar Replied in your comments. For completeness, I've added the missing test cases with different roles.

Should be ready to review.

@mabartos mabartos requested a review from vmuzikar February 9, 2026 16:05
Copy link
Contributor

@Pepo48 Pepo48 left a comment

Choose a reason for hiding this comment

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

Thanks @mabartos, great job!

@mabartos mabartos requested review from vmuzikar and removed request for vmuzikar February 11, 2026 16:44
Copy link
Contributor

@vmuzikar vmuzikar left a comment

Choose a reason for hiding this comment

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

Thank you, looks good.

@vmuzikar vmuzikar merged commit 479d554 into keycloak:main Feb 11, 2026
83 checks passed
msdaly200 pushed a commit to msdaly200/keycloak that referenced this pull request Feb 13, 2026
* [client-v2] Create tests for checking permissions

Closes keycloak#45975

Signed-off-by: Martin Bartoš <[email protected]>

* Simplify admin client creation, test abstraction

Signed-off-by: Martin Bartoš <[email protected]>

* Address Vasek's comments

Signed-off-by: Martin Bartoš <[email protected]>

---------

Signed-off-by: Martin Bartoš <[email protected]>
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.

Create tests for checking permissions

5 participants