I would like to load my Keycloak Settings dynamically from my database. I would like to do this:
- Start my application
- Load from my database required information for the
KeycloakOidcConfigurationObject - Set the values which I got from my database to the
KeycloakOidcConfiguration.
I tried to load it during App Start like this:
InputStream inputStream = getClass().getResourceAsStream("/shiro-web.ini");
Ini ini = new Ini();
ini.load(inputStream);
ini.setSectionProperty("main", "oidcConfig.realm", keycloakApplicationProvider.getRealm());
But this seems not working, I got this error message:
Caused by: org.pac4j.core.exception.TechnicalException: realm cannot be blank
In my shiro.ini I have this config:
#Keycloack
oidcConfig = org.pac4j.oidc.config.KeycloakOidcConfiguration
My question would be: how can I get the current KeycloakOidcConfiguration, which is using from Pac4j / Shiro? It seems for me at the moment I change (set) the wrong KeycloakOidcConfiguration.
Any ideas?
To load the Keycloak settings dynamically from your database, you need to create a
CustomOidcClientand aCustomOidcConfigurationwhich initializes itself from the database.