Skip to content

Commit

Permalink
Removing unnecessary configuration from auth servers
Browse files Browse the repository at this point in the history
Signed-off-by: Pedro Igor <[email protected]>
  • Loading branch information
pedroigor committed Dec 3, 2024
1 parent d65f896 commit f7c57d3
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 127 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,30 +17,16 @@

package org.keycloak.common.util;

import java.util.Collections;
import java.util.Map;
import java.util.Properties;

/**
* @author <a href="mailto:[email protected]">Stian Thorgersen</a>
*/
public class SystemEnvProperties extends Properties {

private final Map<String, String> overrides;

public SystemEnvProperties(Map<String, String> overrides) {
this.overrides = overrides;
}

public SystemEnvProperties() {
this.overrides = Collections.EMPTY_MAP;
}

@Override
public String getProperty(String key) {
if (overrides.containsKey(key)) {
return overrides.get(key);
} else if (key.startsWith("env.")) {
if (key.startsWith("env.")) {
return System.getenv().get(key.substring(4));
} else {
return System.getProperty(key);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
import org.keycloak.services.managers.ApplianceBootstrap;
import org.keycloak.services.resources.KeycloakApplication;
import org.keycloak.services.resteasy.ResteasyKeycloakApplication;
import org.keycloak.testsuite.JsonConfigProviderFactory;
import org.keycloak.testsuite.KeycloakServer;
import org.keycloak.testsuite.UndertowRequestFilter;
import org.keycloak.testsuite.utils.tls.TLSUtils;
Expand Down Expand Up @@ -94,15 +93,6 @@ private DeploymentInfo createAuthServerDeploymentInfo() {
di.setContextPath("/auth");
di.setDeploymentName("Keycloak");
di.setDefaultEncoding("UTF-8");
if (configuration.getKeycloakConfigPropertyOverridesMap() != null) {
try {
di.addInitParameter(JsonConfigProviderFactory.SERVER_CONTEXT_CONFIG_PROPERTY_OVERRIDES,
JsonSerialization.writeValueAsString(configuration.getKeycloakConfigPropertyOverridesMap()));
} catch (IOException ex) {
throw new RuntimeException(ex);
}
}

di.setDefaultServletConfig(new DefaultServletConfig(true));
di.addWelcomePage("theme/keycloak/welcome/resources/index.html");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class KeycloakOnUndertowConfiguration extends UndertowContainerConfigurat
private boolean remoteMode;
private String route;
private String keycloakConfigPropertyOverrides;
private HashMap<String, Object> keycloakConfigPropertyOverridesMap;

private int bindHttpPortOffset = 0;
private int bindHttpsPortOffset = 0;
Expand Down Expand Up @@ -99,18 +98,6 @@ public void setRemoteMode(boolean remoteMode) {
this.remoteMode = remoteMode;
}

public String getKeycloakConfigPropertyOverrides() {
return keycloakConfigPropertyOverrides;
}

public void setKeycloakConfigPropertyOverrides(String keycloakConfigPropertyOverrides) {
this.keycloakConfigPropertyOverrides = keycloakConfigPropertyOverrides;
}

public Map<String, Object> getKeycloakConfigPropertyOverridesMap() {
return keycloakConfigPropertyOverridesMap;
}

@Override
public void validate() throws ConfigurationException {
super.validate();
Expand All @@ -125,15 +112,6 @@ public void validate() throws ConfigurationException {

log.info("KeycloakOnUndertow will listen for http on port: " + newPort + " and for https on port: " + newHttpsPort);

if (this.keycloakConfigPropertyOverrides != null) {
try {
TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
this.keycloakConfigPropertyOverridesMap = JsonSerialization.sysPropertiesAwareMapper.readValue(this.keycloakConfigPropertyOverrides, typeRef);
} catch (IOException ex) {
throw new ConfigurationException(ex);
}
}

// TODO validate workerThreads

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ public class KeycloakQuarkusConfiguration implements ContainerConfiguration {
private int startupTimeoutInSeconds = 300;
private String route;
private String keycloakConfigPropertyOverrides;
private HashMap<String, Object> keycloakConfigPropertyOverridesMap;
private String profile;
private String javaOpts;
private boolean reaugmentBeforeStart;
Expand All @@ -62,15 +61,6 @@ public void validate() throws ConfigurationException {
setBindHttpsPort(newHttpsPort);

log.infof("Keycloak will listen for http on port: %d, for https on port: %d, and for management on port: %d\n", newPort, newHttpsPort, managementPort);

if (this.keycloakConfigPropertyOverrides != null) {
try {
TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
this.keycloakConfigPropertyOverridesMap = JsonSerialization.sysPropertiesAwareMapper.readValue(this.keycloakConfigPropertyOverrides, typeRef);
} catch (IOException ex) {
throw new ConfigurationException(ex);
}
}
}

public int getBindHttpPortOffset() {
Expand Down Expand Up @@ -182,18 +172,6 @@ public void setProfile(String profile) {
this.profile = profile;
}

public String getKeycloakConfigPropertyOverrides() {
return keycloakConfigPropertyOverrides;
}

public void setKeycloakConfigPropertyOverrides(String keycloakConfigPropertyOverrides) {
this.keycloakConfigPropertyOverrides = keycloakConfigPropertyOverrides;
}

public Map<String, Object> getKeycloakConfigPropertyOverridesMap() {
return keycloakConfigPropertyOverridesMap;
}

public void setJavaOpts(String javaOpts) {
this.javaOpts = javaOpts;
}
Expand Down

This file was deleted.

0 comments on commit f7c57d3

Please sign in to comment.