Disable certain providers at runtime (startup) with Keycloak.X #10886
danielFesenmeyer
started this conversation in
Archive
Replies: 2 comments 1 reply
-
|
Hello Daniel, interesting question, I'll take a look :) For completeness you can also disable a provider via CLI argument: |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
Quick Idea: Merge the selection of extension jars that you need for your customers at start time into one and just index that "bundle" jar. |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
we have quite many providers (such as authenticator, mapper and realm-restapi-extension) implemented for several customers.
For each customer, there should be a different set of custom providers available.
We figured out that providers can be disabled by means of build option
spi-<spi-id>-<provider-id>_enabled=false, or by using the env varKC_SPI_<SPI_ID>-<PROVIDER_ID>_ENABLE=falsewith autobuild.I see the following options how we can support disabling of providers in Keycloak.X:
KC_SPI_<SPI_ID>-<PROVIDER_ID>_ENABLE=false) - this code only takes about 0.5 secondsDue to the disadvantages, we don't want to implement Option 1 or 2.
So I tried out Option 3, but was not yet successful with it. My idea was to implement a decorator bean for QuarkusKeycloakApplication (using
@Alternativeand@Priorityannotations), and overwrite the startup method to run the custom initialization before the original startup. The initialization code seemed to work fine, but when requesting any authorized endpoint, I got an exception due to a missing session:Futhermore, this approach has the disadvantage that the init method of each ProviderFactory is already called before, which is not what we want for disabled providers. (This is done in KeycloakRecorder#configSessionFactory).
Does someone know a way to somehow overwrite this recorder method? I'm a quarkus beginner and don't currently know whether that's possible.
Or someone has an other, maybe simpler idea?
Beta Was this translation helpful? Give feedback.
All reactions