Within the org.keycloak.models.jpa.RealmAdapter, whenever fetching a IdentityProviderEntity by alias or by id, replace the logic of
- realm.getIdentityProviders -> loop over all entities within java -> find and return the entity matching the id
with a faster and more memory-efficient
Similarly, for alias (there is a already a namedquery in IdentityProviderEntity for that)
- abolish the loops client -side (java)
- use the "findIdentityProviderByAlias" with entity manager to fetch a single one by alias.
Find by id (or by alias, which is indexed as well), should not be implemented by looping all entities on "java side" in any case