100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Fixed demo configuration
Christian Bauera44f34a26c90
diff --git a/container/src/main/java/org/openremote/container/security/IdentityService.java b/container/src/main/java/org/openremote/container/security/IdentityService.javaindex e19778e88..d771e63e0 100644--- a/container/src/main/java/org/openremote/container/security/IdentityService.java+++ b/container/src/main/java/org/openremote/container/security/IdentityService.java@@ -76,9 +76,14 @@ public abstract class IdentityService implements ContainerService {externalAuthServerUrl = UriBuilder.fromUri("").scheme(this.configNetworkSecure ? "https" : "http").host(this.configNetworkHost)- .port(this.configNetworkWebserverPort).path(AUTH_PATH);+ // Only set the port if it's not the default protocol port. Browsers do this and Keycloak will+ // bake the browsers' redirect URL into the token, so we need a matching config when verifying tokens.+ if (this.configNetworkWebserverPort != 80 && this.configNetworkWebserverPort != 443) {+ externalAuthServerUrl.port(this.configNetworkWebserverPort);+ }+LOG.info("External auth server URL (reverse proxy for Keycloak) is: " + externalAuthServerUrl.build());keycloakHostUri =@@ -244,8 +249,7 @@ public abstract class IdentityService implements ContainerService {// Also correct the backend URL at this time, this URL will be written// by Keycloak as the issuer into each token automaticallyclientInstall.setAuthServerUrlForBackendRequests(- UriBuilder.fromUri(clientInstall.getAuthServerUrl()).path("realms").path(clientInstall.getRealm())- .build().toString()+ externalAuthServerUrl.clone().path("realms").path(clientInstall.getRealm()).build().toString());// Some more bloated infrastructure needed, this is for the Keycloak container adapter whichdiff --git a/docker-compose-demo.yml b/docker-compose-demo.ymlindex caf92242f..f3d3e3199 100644--- a/docker-compose-demo.yml+++ b/docker-compose-demo.yml@@ -11,10 +11,12 @@ services:IMPORT_SAMPLE_DATA: 'true'NETWORK_HOST: demo2.openremote.comNETWORK_WEBSERVER_PORT: 80+ WEB_SERVER_LISTEN_HOST: 0.0.0.0+ WEB_SERVER_LISTEN_PORT: 8080CONTEXT_BROKER_HOST: orionCONTEXT_BROKER_PORT: 1026- IDENTITY_PROVIDER_HOST: keycloak- IDENTITY_PROVIDER_PORT: 8080+ KEYCLOAK_HOST: keycloak+ KEYCLOAK_PORT: 8080ports:- "8090:8080"keycloak:diff --git a/manager/src/main/java/org/openremote/manager/server/SampleDataService.java b/manager/src/main/java/org/openremote/manager/server/SampleDataService.javaindex d6da4a980..558fdd4ed 100644--- a/manager/src/main/java/org/openremote/manager/server/SampleDataService.java+++ b/manager/src/main/java/org/openremote/manager/server/SampleDataService.java@@ -148,17 +148,15 @@ public class SampleDataService implements ContainerService {managerClient.setPublicClient(true);managerClient.setDirectAccessGrantsEnabled(true);- String callbackUrl = UriBuilder.fromUri("")- .scheme(identityService.isConfigNetworkSecure() ? "https" : "http")- .host(identityService.getConfigNetworkHost())- .port(identityService.getConfigNetworkWebserverPort())- .path(MASTER_REALM)- .build().toString();+ String callbackUrl = UriBuilder.fromUri("/").path(MASTER_REALM).path("*").build().toString();List<String> redirectUrls = new ArrayList<>();redirectUrls.add(callbackUrl);managerClient.setRedirectUris(redirectUrls);+ String baseUrl = UriBuilder.fromUri("/").path(MASTER_REALM).build().toString();+ managerClient.setBaseUrl(baseUrl);+String clientResourceLocation =keycloak.registerClientApplication(MASTER_REALM, managerClient).getLocation().toString();diff --git a/container/src/main/resources/logging.properties b/manager/src/main/resources/logging.propertiessimilarity index 100%rename from container/src/main/resources/logging.propertiesrename to manager/src/main/resources/logging.propertiesdiff --git a/manager/src/main/resources/vertx-default-jul-logging.properties b/manager/src/main/resources/vertx-default-jul-logging.propertiesdeleted file mode 100644index f0dbc4948..000000000--- a/manager/src/main/resources/vertx-default-jul-logging.properties+++ /dev/null@@ -1,17 +0,0 @@-handlers=java.util.logging.ConsoleHandler--java.util.logging.ConsoleHandler.formatter=org.openremote.manager.server.util.LogFormatter-java.util.logging.ConsoleHandler.level=FINEST--.level=INFO--org.openremote.level=FINEST--io.vertx.level=INFO-com.hubrick.vertx.rest.level=INFO--org.hibernate.SQL.level=WARNING-org.hibernate.type.descriptor.sql.BasicBinder.level=WARNING-org.hibernate.jpa.internal.util.level = WARNING-org.hibernate.dialect.Dialect.level = WARNING-org.hibernate.validator.internal.xml.ValidationXmlParser.level = WARNING