Repository navigation
How to replace a keycloak builtin EventStoreProvider? #13837
Unanswered
danielFesenmeyer
asked this question in
Q&A
Replies: 1 comment
|
Hi, As discussed in the keycloak dev mailing list, we had the same problem for our custom user provider. When migrating to KC20, it was not working anymore. Our custom user provider is not seen by Keycloak (not displayed in Server info/Providers) and a message tells at startup that the "jpa" provider could not be found. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi,
we have implemented our own "Modified"EventStoreProvider based on JpaEventStoreProvider.
(We did this, because we want to use the functionality provided by this PR: #8822.)
Our "Modified"EventStoreProviderFactory had the ID "jpa-modified" and a higher order than the builtin JpaEventStoreProviderFactory with ID "jpa".
This worked fine with keycloak-legacy version 18: the "Modified"EventStoreProvider was loaded instead of JpaEventStoreProvider.
But it worked no longer with Keycloak.X 19: JpaEventStoreProvider was loaded instead of "Modified"EventStoreProvider.
I tried to fix that by explicitly specifying "jpa-modified" as provider, with the env var mechanism:
KC_SPI_EVENTS_STORE_PROVIDER=jpa-modifiedBut the latter did not work, Keycloak did not recognize the setting - the used provider was still "jpa".
It seems that there is a problem with handling SPI names in camel-case format (eventsStore, in this case).
Hence, I tried the CLI arg mechanism:
--spi-events-store-provider=jpa-modifiedNow, surprisingly the "map" event store was used. After some debugging I found out that this is due to the following implementation in StoragePropertyMappers:
keycloak/quarkus/runtime/src/main/java/org/keycloak/quarkus/runtime/configuration/mappers/StoragePropertyMappers.java
Line 318 in 0f91bee
When no storage config is found, "jpa" is used, otherwise "map". The specified value is completely ignored.
I would expect an error or at least a warning that I have specified an unsupported option.
Furthermore, it seems that it is currently not possible to use any custom implementation, for example an implementation based on a timeseries db.
What finally worked in our use case: I've changed the ID of our "Modified"EventStoreProviderFactory to "jpa". This works. because the ServiceLoader mechanism loads our class before the "overwritten" Keycloak class:
keycloak/services/src/main/java/org/keycloak/provider/ProviderManager.java
Line 94 in 0f91bee
But from my point of view, the mechanism would be more reliable, if the order of the ProviderFactories would be considered, in case there is more than one matching.
I'm just wondering if someone has already solved a similar issue and maybe knows a better solution?
All reactions