Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Draft
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 @@ -112,9 +112,7 @@ void configureHostname() {
optionMapper(keycloakCR -> keycloakCR.getSpec().getHostnameSpec())
.mapOption("hostname", HostnameSpec::getHostname)
.mapOption("hostname-admin", HostnameSpec::getAdmin)
.mapOption("hostname-admin-url", HostnameSpec::getAdminUrl)
.mapOption("hostname-strict", HostnameSpec::isStrict)
.mapOption("hostname-strict-backchannel", HostnameSpec::isStrictBackchannel)
.mapOption("hostname-backchannel-dynamic", HostnameSpec::isBackchannelDynamic);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,15 @@
@Buildable(editableEnabled = false, builderPackage = "io.fabric8.kubernetes.api.builder")
public class HostnameSpec implements Serializable {

@JsonPropertyDescription("Hostname for the Keycloak server. Applicable for Hostname v1 and v2.")
@JsonPropertyDescription("Hostname for the Keycloak server. Applicable for Hostname v2.")
private String hostname;

@JsonPropertyDescription("The hostname for accessing the administration console. Applicable for Hostname v1 and v2.")
@JsonPropertyDescription("The hostname for accessing the administration console. Applicable for Hostname v2.")
private String admin;

@JsonPropertyDescription("DEPRECATED. Sets the base URL for accessing the administration console, including scheme, host, port and path. Applicable for Hostname v1.")
private String adminUrl;

@JsonPropertyDescription("Disables dynamically resolving the hostname from request headers. Applicable for Hostname v1 and v2.")
@JsonPropertyDescription("Disables dynamically resolving the hostname from request headers. Applicable for Hostname v2.")
private Boolean strict;

@JsonPropertyDescription("DEPRECATED. By default backchannel URLs are dynamically resolved from request headers to allow internal and external applications. Applicable for Hostname v1.")
private Boolean strictBackchannel;

@JsonPropertyDescription("Enables dynamic resolving of backchannel URLs, including hostname, scheme, port and context path. Set to true if your application accesses Keycloak via a private network. Applicable for Hostname v2.")
private Boolean backchannelDynamic;

Expand All @@ -61,14 +55,6 @@ public void setAdmin(String admin) {
this.admin = admin;
}

public String getAdminUrl() {
return adminUrl;
}

public void setAdminUrl(String adminUrl) {
this.adminUrl = adminUrl;
}

public Boolean isStrict() {
return strict;
}
Expand All @@ -77,14 +63,6 @@ public void setStrict(Boolean strict) {
this.strict = strict;
}

public Boolean isStrictBackchannel() {
return strictBackchannel;
}

public void setStrictBackchannel(Boolean strictBackchannel) {
this.strictBackchannel = strictBackchannel;
}

public Boolean isBackchannelDynamic() {
return backchannelDynamic;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,7 @@ public void testIngressOnHTTP() {
kc.getSpec().getHttpSpec().setTlsSecret(null);
kc.getSpec().getHttpSpec().setHttpEnabled(true);
var hostnameSpecBuilder = new HostnameSpecBuilder()
.withStrict(false)
.withStrictBackchannel(false);
.withStrict(false);
if (isOpenShift) {
kc.getSpec().setIngressSpec(new IngressSpecBuilder().withIngressClassName(KeycloakController.OPENSHIFT_DEFAULT).build());
}
Expand All @@ -78,8 +77,7 @@ public void testIngressOnHTTP() {
public void testIngressOnHTTPSAndProxySettings() {
var kc = getTestKeycloakDeployment(false);
var hostnameSpecBuilder = new HostnameSpecBuilder()
.withStrict(false)
.withStrictBackchannel(false);
.withStrict(false);
if (isOpenShift) {
kc.getSpec().setIngressSpec(new IngressSpecBuilder().withIngressClassName(KeycloakController.OPENSHIFT_DEFAULT).build());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,19 +123,15 @@ public void hostnameSpecification() {

assertThat(hostnameSpec.getHostname(), is("my-hostname"));
assertThat(hostnameSpec.getAdmin(), is("my-admin-hostname"));
assertThat(hostnameSpec.getAdminUrl(), is("https://www.my-admin-hostname.org:8448/something"));
assertThat(hostnameSpec.isStrict(), is(true));
assertThat(hostnameSpec.isStrictBackchannel(), is(true));

keycloak = Serialization.unmarshal(this.getClass().getResourceAsStream("/empty-podtemplate-keycloak.yml"), Keycloak.class);

hostnameSpec = keycloak.getSpec().getHostnameSpec();
assertThat(hostnameSpec, notNullValue());
assertThat(hostnameSpec.getHostname(), is("example.com"));
assertThat(hostnameSpec.getAdmin(), nullValue());
assertThat(hostnameSpec.getAdminUrl(), nullValue());
assertThat(hostnameSpec.isStrict(), nullValue());
assertThat(hostnameSpec.isStrictBackchannel(), nullValue());
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,7 @@ public void db() {
public void hostname() {
final Map<String, String> expectedValues = Map.of(
"hostname", "my-hostname",
"hostname-admin-url", "https://www.my-admin-hostname.org:8448/something",
"hostname-strict", "true",
"hostname-strict-backchannel", "true",
"hostname-backchannel-dynamic", "true",
"hostname-admin", "my-admin-hostname"
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,7 @@ spec:
hostname:
hostname: my-hostname
admin: my-admin-hostname
adminUrl: https://www.my-admin-hostname.org:8448/something
strict: true
strictBackchannel: true
backchannelDynamic: true
cache:
configMapFile:
Expand Down