-
Notifications
You must be signed in to change notification settings - Fork 7.7k
Client Resource must return a single item (#39851) #43382
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
base: main
Are you sure you want to change the base?
Client Resource must return a single item (#39851) #43382
Conversation
af04a23
to
cec612a
Compare
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
List<ClientRepresentation> findByClientId(@QueryParam("clientId") String clientId); | ||
ClientRepresentation findByClientId(@QueryParam("clientId") String clientId); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please see keycloak/keycloak-client#155 (comment) and use the method name findClientByClientId, then deprecate findByClientId.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawkins Thanks for the thorough review and helpful suggestions! I’ve addressed the feedback and pushed updates relating to #39851 and #155 :
-
Renamed the API to findClientByClientId(String) and deprecated findByClientId(String)
-
Kept the old method as a compat shim delegating to the new one (returns empty/singleton list) ClientTest.findByClientListResult()
-
Migrated tests to the new API and standardized assertions (assertNotNull, assertNull, etc.);retained one minimal compat test with @SuppressWarnings("deprecation")
This is my first PR to Keycloak—happy to take any suggestions or guidance to align with project requirements.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is my first PR to Keycloak—happy to take any suggestions or guidance to align with project requirements.
@cherifyazid thank you for this pr. Everything looks good - can you also add a DCO sign off to your commit?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawkins Done !
|
||
ClientRepresentation client = clients.get(0); | ||
ClientRepresentation client = realmResource.clients().findByClientId("myclient"); | ||
assertNotNull(client); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Keep the same style of assertion, use static method of Assertions
class instead of static import, just to unify the way asserts are used
Prefer Assertions.assertNotNull(client);
85f3411
to
086ef7a
Compare
086ef7a
to
fd73a1f
Compare
fd73a1f
to
56f9526
Compare
56f9526
to
40d7aab
Compare
Closes keycloak#39851 Signed-off-by: CHERIF Yazid <yadzinov@gmail.com> Remove unused imports as part of keycloak#43233 Signed-off-by: stianst <stianst@gmail.com>
40d7aab
to
2d16e23
Compare
We have such a method org.keycloak.admin.client.resource.ClientsResource.findByClientId(String) that should return a single item, but it returns a List of ClientRepresentation.
for more details please check the issue description
Closes #39851
Signed-off-by: cherifyazid yadzinov@gmail.com