In my SpringBoot application, I pass my keycloak configuration parameters in the application.properties file. However, I'd like to know if there is a way to let keycloak read these parameters from the code rather than from application.properties.
For example, I retrieve the Realm, Server URL, ClientID and other parameters from a database, I'd like to tell keycloak to read from the database directly or from String that I declare when it launches.
Is that possible?
Thank you
Similar to KeycloakSpringBootConfigResolver, your database reader class must implement KeycloakConfigResolver
and should be provided as bean.
public class KeycloakDBConfigResolver implements org.keycloak.adapters.KeycloakConfigResolver {
@Override
public KeycloakDeployment resolve(OIDCHttpFacade.Request request) {
//Read keycloak configuration from Database
}
}
resolve()
method should read keycloak configuration from Database and construct KeycloakDeployment.