Make KeycloakServer runnable with external Infinispan server

Closes #12011
Closes #12014
This commit is contained in:
Michal Hajas 2022-05-16 15:21:37 +02:00 committed by Hynek Mlnařík
parent b5a5d68dbc
commit b86f205cda
3 changed files with 18 additions and 14 deletions

View file

@ -118,20 +118,19 @@ public class DefaultHotRodConnectionProviderFactory implements HotRodConnectionP
registerSchemata(ProtoSchemaInitializer.INSTANCE);
String reindexCaches = config.get("reindexCaches", null);
RemoteCacheManagerAdmin administration = remoteCacheManager.administration();
if (config.getBoolean("reindexAllCaches", false)) {
if (reindexCaches != null && reindexCaches.equals("all")) {
LOG.infof("Reindexing all caches. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results.");
remoteCaches.forEach(administration::reindexCache);
} else {
String reindexCaches = config.get("reindexCaches", "");
if (reindexCaches != null) {
Arrays.stream(reindexCaches.split(","))
.map(String::trim)
.filter(e -> !e.isEmpty())
.filter(remoteCaches::contains)
.peek(cacheName -> LOG.infof("Reindexing %s cache. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results.", cacheName))
.forEach(administration::reindexCache);
}
} else if (reindexCaches != null && !reindexCaches.isEmpty()){
Arrays.stream(reindexCaches.split(","))
.map(String::trim)
.filter(e -> !e.isEmpty())
.filter(remoteCaches::contains)
.peek(cacheName -> LOG.infof("Reindexing %s cache. This can take a long time to complete. While the rebuild operation is in progress, queries might return fewer results.", cacheName))
.forEach(administration::reindexCache);
}
}

View file

@ -264,7 +264,7 @@
"username": "${keycloak.connectionsHotRod.username:myuser}",
"password": "${keycloak.connectionsHotRod.password:qwer1234!}",
"enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:true}",
"reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:auth-sessions,clients,client-scopes,groups,users,user-login-failures,user-sessions,client-sessions,roles,realms,authz}"
"reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:all}"
}
},

View file

@ -231,10 +231,15 @@
"default": {
"embedded": "${keycloak.connectionsHotRod.embedded:true}",
"embeddedPort": "${keycloak.connectionsHotRod.embeddedPort:11444}",
"enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:false}"
"enableSecurity": "${keycloak.connectionsHotRod.enableSecurity:false}",
"port": "${keycloak.connectionsHotRod.port:11444}",
"host": "${keycloak.connectionsHotRod.host:localhost}",
"configureRemoteCaches": "${keycloak.connectionsHotRod.configureRemoteCaches:false}",
"username": "${keycloak.connectionsHotRod.username:admin}",
"password": "${keycloak.connectionsHotRod.password:admin}",
"reindexCaches": "${keycloak.connectionsHotRod.reindexCaches:}"
}
},
"scripting": {
},