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

Initial pagination in the admin REST API for identity providers #22003

Merged
merged 1 commit into from
Jul 27, 2023

Conversation

rmartinc
Copy link
Contributor

Closes #21073

Initial pagination to start working in identity providers. As you can see it's (for the moment) just a wrapper that iterates on the current complete list of identity providers. Once merged the UI team can start working on using the new endpoint and we can also start working on modifying the model API. When UI team finishes moving to the endpoint we can also start not returning the list of providers in realm endpoints. Changes from #21487:

  • Added sorting in the endpoint until the sorting is moved to the model API.
  • Added briefRepresentation with internalid, providerid, alias, displayname and enabled (false by default).

@mposolda @jonkoops @cgeorgilakis FYI

Copy link
Contributor

@mposolda mposolda left a comment

Choose a reason for hiding this comment

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

@rmartinc Thanks!

It looks good to me. Added only queestion regarding "count" endpoint and also one minor inline comment/suggestion.

@Operation( summary = "Get identity providers")
public Response getIdentityProviders(@Parameter(description = "Provider id") @PathParam("provider_id") String providerId) {
@Operation( summary = "Get the identity provider factory for that provider id")
public IdentityProviderFactory getIdentityProviders(@Parameter(description = "The provider id to get the factory") @PathParam("provider_id") String providerId) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Minor: Thanks for updating the outdated javadoc and description. But method name is still slightly outdated. This minor change to update it.

Suggested change
public IdentityProviderFactory getIdentityProviders(@Parameter(description = "The provider id to get the factory") @PathParam("provider_id") String providerId) {
public IdentityProviderFactory getIdentityProviderFactory(@Parameter(description = "The provider id to get the factory") @PathParam("provider_id") String providerId) {

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done!

@Produces(MediaType.APPLICATION_JSON)
@Tag(name = KeycloakOpenAPI.Admin.Tags.IDENTITY_PROVIDERS)
@Operation( summary = "Count identity providers")
public Integer countIdentityProviders(
Copy link
Contributor

Choose a reason for hiding this comment

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

Sorry I did not spot it before, but do we really need count endpoint?

I know that we have "count" for some objects, but for instance, I've checked clients (which already support pagination). And the ClientsResource does not have any "count" endpoint for clients. It seems that admin console doesn't need it as it does not display the count of search results and count of pages for clients. It just display arrow for next page (if exists).

IMO if admin console doesn't need "count" endpoint, then my vote would be to skip "count" endpoint. I would just go for necessary minimum to have admin console working (Especially since we may migrate to "Admin REST API v2" and hence adding more unnecessary mess to admin REST API doesn't help...)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah! Okis, the I will remove the count endpoint. I just added it because I cloned the behavior in the users endpoints.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, we're not using this at the moment. Perhaps we should, but pagination is just kinda borked in general atm. That won't change until we start working on a proper V2 API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the count endpoint!

@GET
@Path("instances/count")
@Produces(MediaType.APPLICATION_JSON)
Integer count(@QueryParam("search") String search);
Copy link
Contributor

Choose a reason for hiding this comment

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

See my other comment for "count" endpoint

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the count endpoint!

@mposolda
Copy link
Contributor

@rmartinc @jonkoops I would like to also add that follow-up work in admin console might not need to be responsibility of UI team. We will hopefully have contribution from "tenant & admin team". But we will need UI team for the review the contributions once they arrive.

@jonkoops
Copy link
Contributor

@mposolda No problem, we're always happy to review work from the community.

Copy link
Contributor

@mposolda mposolda left a comment

Choose a reason for hiding this comment

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

@rmartinc Thanks for the updates!

@mposolda mposolda merged commit 0a7fcf4 into keycloak:main Jul 27, 2023
76 checks passed
@jonkoops
Copy link
Contributor

Do we have an issue logged somewhere to implement this in the UI as well?

@mposolda
Copy link
Contributor

@jonkoops Yes, UI issue is here #21074 . The whole epic is here #21071

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.

Identity providers: pagination in admin REST API
3 participants