Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getPolicyId and getResourceId not working correctly if there are >100 entities in realm #1127

Open
test4423 opened this issue Aug 14, 2024 · 2 comments
Labels

Comments

@test4423
Copy link

Current Behavior

When getPolicyId or getResourceId are called, they only search the first 100 policies/resources because they call Keycloak API without "max" parameter:

ClientRepository.java:

private String getPolicyId(ClientResource clientResource, String policyName) {
  return clientResource.authorization().policies().policies() // no parameters
private String getResourceId(ClientResource clientResource, String resourceName) {
  return clientResource.authorization().resources() // no parameters

The following code seems to work fine:

private String getPolicyId(ClientResource clientResource, String policyName) {
  return clientResource.authorization().policies().policies(null, null, null, null, null, null, null, null, -1, -1)
private String getResourceId(ClientResource clientResource, String resourceName) {
   return clientResource.authorization().resources().find(null, null, null, null, null, -1, -1)

Perhaps even findByName() could be used there, but I didn't test it.

Expected Behavior

These methods should search all policies/resources

Steps To Reproduce

No response

Environment

  • Keycloak Version: 25.0.1
  • keycloak-config-cli Version: 6.1.7
  • Java Version: 21

Anything else?

No response

@test4423 test4423 added the bug label Aug 14, 2024
@bohmber
Copy link
Contributor

bohmber commented Sep 26, 2024

@test4423 @francis-pouatcha Could be fixed by #1096

@francis-pouatcha
Copy link
Member

@test4423 #1096 was merged. Can you please retest?

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

No branches or pull requests

3 participants