8000 fix: removing the use of hostname-strict-https mistakenly brought back by shawkins · Pull Request #38536 · keycloak/keycloak · GitHub
[go: up one dir, main page]

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void run() {
picocli.start();
}
}

protected void doBeforeRun() {

}
Expand All @@ -58,7 +58,7 @@ protected void doBeforeRun() {
protected void validateConfig() {
super.validateConfig(); // we want to run the generic validation here first to check for unknown options
HttpPropertyMappers.validateConfig();
HostnameV2PropertyMappers.validateConfig();
HostnameV2PropertyMappers.validateConfig(picocli);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@
import java.util.List;
import java.util.stream.Stream;

import org.jboss.logging.Logger;
import org.keycloak.common.Profile;
import org.keycloak.config.HostnameV2Options;
import org.keycloak.quarkus.runtime.cli.Picocli;
import org.keycloak.quarkus.runtime.configuration.Configuration;

public final class HostnameV2PropertyMappers {

private static final Logger LOGGER = Logger.getLogger(PropertyMappers.class);

private static final List<String> REMOVED_OPTIONS = Arrays.asList("hostname-admin-url", "hostname-path", "hostname-port", "hostname-strict-backchannel", "hostname-url", "proxy", "hostname-strict-https");

private HostnameV2PropertyMappers(){}
Expand All @@ -35,12 +34,12 @@ public static PropertyMapper<?>[] getHostnamePropertyMappers() {
.map(b -> b.isEnabled(() -> Profile.isFeatureEnabled(Profile.Feature.HOSTNAME_V2), "hostname:v2 feature is enabled").build())
.toArray(s -> new PropertyMapper<?>[s]);
}
public static void validateConfig() {

public static void validateConfig(Picocli picocli) {
List<String> inUse = REMOVED_OPTIONS.stream().filter(s -> Configuration.getOptionalKcValue(s).isPresent()).toList();

if (!inUse.isEmpty()) {
LOGGER.errorf("Hostname v1 options %s are still in use, please review your configuration", inUse);
picocli.warn("Hostname v1 options %s are still in use, please review your configuration".formatted(inUse));
}
}

Expand Down
2 changes: 0 additions & 2 deletions quarkus/runtime/src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ quarkus.http.limits.max-header-size=65535
# Default, and insecure, and non-production grade configuration for the development profile
%dev.kc.http-enabled=true
%dev.kc.hostname-strict=false
%dev.kc.hostname-strict-https=false
%dev.kc.cache=local
%dev.kc.spi-theme-cache-themes=false
%dev.kc.spi-theme-cache-templates=false
Expand All @@ -68,7 +67,6 @@ quarkus.http.limits.max-header-size=65535
%nonserver.kc.http-enabled=true
%nonserver.kc.http-server-enabled=false
%nonserver.kc.hostname-strict=false
%nonserver.kc.hostname-strict-https=false
%nonserver.kc.cache=local

#logging defaults
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ void failEnvNotSet(LaunchResult result) {
void createAdmin(LaunchResult result) {
assertTrue(result.getErrorOutput().isEmpty(), result.getErrorOutput());
}

@Test
@Launch({ "start-dev", "--bootstrap-admin-password=MY_PASSWORD" })
void createAdminWithCliOptions(LaunchResult result) {
Expand Down Expand Up @@ -94,12 +94,12 @@ void createAndUseSericeAccountAdmin(KeycloakDistribution dist) throws Exception
assertTrue(result.getErrorOutput().isEmpty(), result.getErrorOutput());

rawDist.setManualStop(true);
rawDist.run("start-dev", "--log-level=debug");
rawDist.run("start-dev");

CLIResult adminResult = rawDist.kcadm("get", "clients", "--server", "http://localhost:8080", "--realm", "master", "--client", "admin", "--secret", "admin123");

assertEquals(0, adminResult.exitCode());
assertTrue(adminResult.getOutput().contains("clientId"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestMethodOrder;
import org.junit.jupiter.api.condition.EnabledOnOs;
import org.junit.jupiter.api.condition.OS;
import org.keycloak.it.junit5.extension.CLIResult;
import org.keycloak.it.junit5.extension.DistributionTest;
import org.keycloak.it.junit5.extension.DryRun;
Expand All @@ -34,6 +32,7 @@
import java.io.File;
import java.nio.file.Paths;

import static org.junit.Assert.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

@DistributionTest
Expand All @@ -47,6 +46,9 @@ public class StartDevCommandDistTest {
@Launch({ "start-dev" })
void testDevModeWarning(CLIResult cliResult) {
cliResult.assertStartedDevMode();
String out = cliResult.getOutput().toUpperCase();
assertFalse(out.contains("WARN"));
assertFalse(out.contains("ERROR"));
}

@DryRun
Expand Down
0