Repository navigation
Support briefRepresentation in RealmsResource.findAll() - #55209
mushfika-faria-nova wants to merge 1 commit into
Conversation
Closes keycloak#55207 Signed-off-by: Mushfika Faria Nova <mushfika.faria.nova@gmail.com>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the Java admin-client overload supporting brief realm representations.
No open issues 🎉
What changed in this PR
Adds Java admin client support for the existing realm-listing briefRepresentation parameter, addressing #55207 without server-side changes.
Changes:
- Adds
findAll(boolean briefRepresentation)while preserving the existing no-argument method. - Documents the brief representation fields.
- Adds a test verifying that brief and full responses contain the same realms, with the expected field differences.
| File | Description |
|---|---|
tests/base/src/test/java/org/keycloak/tests/admin/realm/RealmCreateTest.java |
Tests realm listings with brief and full representations. |
integration/admin-client-core/src/main/java/org/keycloak/admin/client/resource/RealmsResource.java |
Adds and documents the overload accepting briefRepresentation. |
Review effort: Balanced
jamesconwaydev
left a comment
There was a problem hiding this comment.
LGTM. On main, RealmsAdminResource.getRealms takes @DefaultValue("false") @QueryParam("briefRepresentation"), and ModelToRepresentation.toBriefRepresentation(RealmModel) sets exactly id, realm, displayName, displayNameHtml and enabled, so the javadoc matches.
One detail the javadoc could mention: in toRealmRep, a realm where canView fails but isAdmin passes comes back with only realm set, whether brief or not.
Read only: I checked RealmsAdminResource.java and ModelToRepresentation.java on main and didn't run it. Written with help from an AI assistant (Claude Code); each reference was checked against the source.
|
@jamesconwaydev Thanks for checking. Good point about the isAdmin-only case. That applies to the existing findAll() too, so I kept the Javadoc to the brief/full difference. Happy to add a line if the maintainers prefer. |
Closes #55207
The admin REST endpoint
GET /admin/realmsalready supportsbriefRepresentation, but the Java admin client'sRealmsResourceonly hadfindAll()without parameters. This addsfindAll(boolean briefRepresentation)and keeps the existingfindAll()for compatibility. Requested in keycloak/keycloak-client#202.Testing
RealmCreateTest#getRealmsBriefRepresentation: brief and full return the same realms; brief realms have noaccessTokenLifespan, full realms do.expected: <null> but was: <60>).RealmCreateTest#getRealmsand the new test pass locally (embedded server). Spotless applied, no changes.I used an AI assistant (Claude) to draft the change and the test; I reviewed, built and tested it myself.