KEYCLOAK-5656 Remove remoteServers configuration option
This commit is contained in:
parent
c6483f8b1e
commit
fe972ce12b
5 changed files with 0 additions and 56 deletions
|
@ -123,7 +123,6 @@ Keycloak servers setup
|
|||
<store class="org.keycloak.models.sessions.infinispan.remotestore.KeycloakRemoteStoreConfigurationBuilder" passivation="false" fetch-state="false" purge="false" preload="false" shared="true">
|
||||
<property name="rawValues">true</property>
|
||||
<property name="marshaller">org.keycloak.cluster.infinispan.KeycloakHotRodMarshallerFactory</property>
|
||||
<property name="remoteServers">localhost:${remote.cache.port}</property>
|
||||
<property name="remoteCacheName">work</property>
|
||||
<property name="sessionCache">false</property>
|
||||
</store>
|
||||
|
|
|
@ -355,7 +355,6 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
|
|||
builder.persistence()
|
||||
.passivation(false)
|
||||
.addStore(KeycloakRemoteStoreConfigurationBuilder.class)
|
||||
.remoteServers(jdgServer + ":" + jdgPort)
|
||||
.sessionCache(sessionCache)
|
||||
.fetchPersistentState(false)
|
||||
.ignoreModifications(false)
|
||||
|
@ -384,7 +383,6 @@ public class DefaultInfinispanConnectionProviderFactory implements InfinispanCon
|
|||
builder.persistence()
|
||||
.passivation(false)
|
||||
.addStore(KeycloakRemoteStoreConfigurationBuilder.class)
|
||||
.remoteServers(jdgServer + ":" + jdgPort)
|
||||
.sessionCache(false)
|
||||
.fetchPersistentState(false)
|
||||
.ignoreModifications(false)
|
||||
|
|
|
@ -31,18 +31,15 @@ import org.infinispan.persistence.remote.configuration.RemoteStoreConfiguration;
|
|||
public class KeycloakRemoteStoreConfiguration extends RemoteStoreConfiguration {
|
||||
|
||||
static final AttributeDefinition<String> USE_CONFIG_TEMPLATE_FROM_CACHE = AttributeDefinition.builder("useConfigTemplateFromCache", null, String.class).immutable().build();
|
||||
static final AttributeDefinition<String> REMOTE_SERVERS = AttributeDefinition.builder("remoteServers", null, String.class).immutable().build();
|
||||
static final AttributeDefinition<Boolean> SESSION_CACHE = AttributeDefinition.builder("sessionCache", null, Boolean.class).immutable().build();
|
||||
|
||||
private final Attribute<String> useConfigTemplateFromCache;
|
||||
private final Attribute<String> remoteServers;
|
||||
private final Attribute<Boolean> sessionCache;
|
||||
|
||||
|
||||
public KeycloakRemoteStoreConfiguration(RemoteStoreConfiguration other) {
|
||||
super(other.attributes(), other.async(), other.singletonStore(), other.asyncExecutorFactory(), other.connectionPool());
|
||||
useConfigTemplateFromCache = attributes.attribute(USE_CONFIG_TEMPLATE_FROM_CACHE.name());
|
||||
remoteServers = attributes.attribute(REMOTE_SERVERS.name());
|
||||
sessionCache = attributes.attribute(SESSION_CACHE.name());
|
||||
}
|
||||
|
||||
|
@ -52,11 +49,6 @@ public class KeycloakRemoteStoreConfiguration extends RemoteStoreConfiguration {
|
|||
}
|
||||
|
||||
|
||||
public String remoteServers() {
|
||||
return remoteServers.get();
|
||||
}
|
||||
|
||||
|
||||
public Boolean sessionCache() {
|
||||
return sessionCache.get()==null ? false : sessionCache.get();
|
||||
}
|
||||
|
|
|
@ -18,9 +18,7 @@
|
|||
package org.keycloak.models.sessions.infinispan.remotestore;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.infinispan.commons.CacheConfigurationException;
|
||||
import org.infinispan.commons.configuration.attributes.Attribute;
|
||||
|
@ -49,10 +47,6 @@ public class KeycloakRemoteStoreConfigurationBuilder extends RemoteStoreConfigur
|
|||
Attribute<String> attribute = def.toAttribute();
|
||||
attributesInternal.put(def.name(), attribute);
|
||||
|
||||
def = KeycloakRemoteStoreConfiguration.REMOTE_SERVERS;
|
||||
attribute = def.toAttribute();
|
||||
attributesInternal.put(def.name(), attribute);
|
||||
|
||||
AttributeDefinition<Boolean> defBool = KeycloakRemoteStoreConfiguration.SESSION_CACHE;
|
||||
Attribute<Boolean> attributeBool = defBool.toAttribute();
|
||||
attributesInternal.put(defBool.name(), attributeBool);
|
||||
|
@ -65,12 +59,6 @@ public class KeycloakRemoteStoreConfigurationBuilder extends RemoteStoreConfigur
|
|||
|
||||
@Override
|
||||
public KeycloakRemoteStoreConfiguration create() {
|
||||
String remoteServersAttr = attributes.attribute(KeycloakRemoteStoreConfiguration.REMOTE_SERVERS).get();
|
||||
boolean isServersAlreadySet = isServersAlreadySet();
|
||||
if (remoteServersAttr != null && !isServersAlreadySet) {
|
||||
parseRemoteServersAttr(remoteServersAttr);
|
||||
}
|
||||
|
||||
RemoteStoreConfiguration cfg = super.create();
|
||||
KeycloakRemoteStoreConfiguration cfg2 = new KeycloakRemoteStoreConfiguration(cfg);
|
||||
return cfg2;
|
||||
|
@ -83,40 +71,8 @@ public class KeycloakRemoteStoreConfigurationBuilder extends RemoteStoreConfigur
|
|||
}
|
||||
|
||||
|
||||
public KeycloakRemoteStoreConfigurationBuilder remoteServers(String remoteServers) {
|
||||
attributes.attribute(KeycloakRemoteStoreConfiguration.REMOTE_SERVERS).set(remoteServers);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public KeycloakRemoteStoreConfigurationBuilder sessionCache(Boolean sessionCache) {
|
||||
attributes.attribute(KeycloakRemoteStoreConfiguration.SESSION_CACHE).set(sessionCache);
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
private void parseRemoteServersAttr(String remoteServers) {
|
||||
StringTokenizer st = new StringTokenizer(remoteServers, ",");
|
||||
|
||||
while (st.hasMoreElements()) {
|
||||
String nodeStr = st.nextToken();
|
||||
String[] node = nodeStr.trim().split(":", 2);
|
||||
|
||||
addServer()
|
||||
.host(node[0].trim())
|
||||
.port(Integer.parseInt(node[1].trim()));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private boolean isServersAlreadySet() {
|
||||
try {
|
||||
Field f = Reflections.findDeclaredField(RemoteStoreConfigurationBuilder.class, "servers");
|
||||
f.setAccessible(true);
|
||||
List originalRemoteServers = (List) f.get(this);
|
||||
return !originalRemoteServers.isEmpty();
|
||||
} catch (IllegalAccessException iae) {
|
||||
throw new RuntimeException(iae);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,6 @@ echo ** Update replicated-cache work element **
|
|||
name=properties, value={ \
|
||||
rawValues=true, \
|
||||
marshaller=org.keycloak.cluster.infinispan.KeycloakHotRodMarshallerFactory, \
|
||||
remoteServers=localhost:${remote.cache.port}, \
|
||||
remoteCacheName=work, \
|
||||
sessionCache=false \
|
||||
} \
|
||||
|
|
Loading…
Reference in a new issue