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
Upgrade Keycloak dependencies to work with Keycloak 26.7.0 (#3070)
Rich Turnerbf6ea01acd63
diff --git a/.ci_cd/aws/cloudformation-create-ec2.yml b/.ci_cd/aws/cloudformation-create-ec2.ymlindex 04b212e91..a37b76963 100644--- a/.ci_cd/aws/cloudformation-create-ec2.yml+++ b/.ci_cd/aws/cloudformation-create-ec2.yml@@ -426,7 +426,7 @@ Resources:sample_limit: 10000static_configs:- targets:- - localhost:8404+ - 127.0.0.1:8404- labels:InstanceName: '${Host}' # DOESN'T WORK https://github.com/aws/amazon-cloudwatch-agent/issues/751metric_relabel_configs:@@ -443,7 +443,7 @@ Resources:sample_limit: 10000static_configs:- targets:- - localhost:8405+ - 127.0.0.1:8405- labels:InstanceName: '${Host}' # DOESN'T WORK https://github.com/aws/amazon-cloudwatch-agent/issues/751metric_relabel_configs:diff --git a/.github/workflows/ci_cd.yml b/.github/workflows/ci_cd.ymlindex bb25603f2..7e8f0ac61 100644--- a/.github/workflows/ci_cd.yml+++ b/.github/workflows/ci_cd.yml@@ -736,7 +736,7 @@ jobs:# Run the tests${{ steps.test-backend-command.outputs.value }}- timeout-minutes: 20+ timeout-minutes: 30#continue-on-error: true- name: Generate backend test reportsdiff --git a/README.md b/README.mdindex eacce5943..53cc0d183 100644--- a/README.md+++ b/README.md@@ -30,7 +30,7 @@ docker compose pulldocker compose -p openremote up```-If all goes well then you should now be able to access the OpenRemote Manager UI at [https://localhost](https://localhost). You will need to accept the self-signed+If all goes well then you should now be able to access the OpenRemote Manager UI at [https://127.0.0.1](https://127.0.01). You will need to accept the self-signedcertificate, see [here](https://www.technipages.com/google-chrome-bypass-your-connection-is-not-private-message) for details how to do this in Chrome (similar for other browsers).### Login credentials@@ -40,7 +40,7 @@ Password: secret### Changing host and/or port-The URL you use to access the system is important, the default is configured as `https://localhost` if you are using a VM then you will need to set the `OR_HOSTNAME` environment variable, so if for example you will be accessing using `https://192.168.1.1` then use the following startup command:+The URL you use to access the system is important, the default is configured as `https://127.0.0.1` if you are using a VM then you will need to set the `OR_HOSTNAME` environment variable, so if for example you will be accessing using `https://192.168.1.1` then use the following startup command:BASH:diff --git a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXConnection.java b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXConnection.javaindex e729578d4..b8a0ae877 100644--- a/agent/src/main/java/org/openremote/agent/protocol/knx/KNXConnection.java+++ b/agent/src/main/java/org/openremote/agent/protocol/knx/KNXConnection.java@@ -22,7 +22,6 @@ import static org.openremote.model.syslog.SyslogCategory.PROTOCOL;import java.net.InetAddress;import java.net.InetSocketAddress;-import java.net.UnknownHostException;import java.util.*;import java.util.concurrent.ScheduledExecutorService;import java.util.concurrent.ScheduledFuture;@@ -106,7 +105,7 @@ public class KNXConnection implements NetworkLinkListener, ProcessListener {if (StringUtils.isNotBlank(this.bindAddress)) {localEndPoint = new InetSocketAddress(this.bindAddress, 0);} else {- InetAddress localHost = InetAddress.getLocalHost();+ InetAddress localHost = InetAddress.getLoopbackAddress();localEndPoint = new InetSocketAddress(localHost, 0);}if (!routingMode) {@@ -152,8 +151,6 @@ public class KNXConnection implements NetworkLinkListener, ProcessListener {} catch (final KNXException | InterruptedException e) {LOG.log(Level.INFO, "Connection error", e.getMessage());scheduleReconnect();- } catch (final UnknownHostException e) {- LOG.log(Level.INFO, "Connection error", e.getMessage());}}diff --git a/agent/src/main/java/org/openremote/agent/protocol/serial/JSerialCommChannel.java b/agent/src/main/java/org/openremote/agent/protocol/serial/JSerialCommChannel.javaindex 38971ba68..b7cff822d 100644--- a/agent/src/main/java/org/openremote/agent/protocol/serial/JSerialCommChannel.java+++ b/agent/src/main/java/org/openremote/agent/protocol/serial/JSerialCommChannel.java@@ -33,7 +33,7 @@ import java.util.concurrent.TimeUnit;public class JSerialCommChannel extends io.netty.channel.oio.OioByteStreamChannel {private static final JSerialCommDeviceAddress LOCAL_ADDRESS =- new JSerialCommDeviceAddress("localhost");+ new JSerialCommDeviceAddress("127.0.0.1");private final JSerialCommChannelConfig config;diff --git a/agent/src/main/proto/chirpstack/api/application.proto b/agent/src/main/proto/chirpstack/api/application.protoindex 810376b0d..12017c22c 100644--- a/agent/src/main/proto/chirpstack/api/application.proto+++ b/agent/src/main/proto/chirpstack/api/application.proto@@ -605,7 +605,7 @@ message InfluxDbIntegration {// Application ID (UUID).string application_id = 1;- // InfluxDb API write endpoint (e.g. http://localhost:8086/write).+ // InfluxDb API write endpoint (e.g. http://127.0.0.1:8086/write).string endpoint = 2;// InfluxDb database name. (InfluxDb v1)diff --git a/balena/env b/balena/envindex f099ba753..d395d2cd5 100644--- a/balena/env+++ b/balena/env@@ -1,6 +1,5 @@-KC_HOSTNAME=localhost+KC_HOSTNAME=https://localhost/authKC_HOSTNAME_STRICT=false-KEYCLOAK_ISSUER_BASE_URI=https://localhost/authOR_ADDITIONAL_HOSTNAMES=localhostOR_HOSTNAME=localhostOR_MAIN_THREAD_WAIT_MS=10diff --git a/balena/manager.Dockerfile b/balena/manager.Dockerfileindex 922115033..7278de16e 100644--- a/balena/manager.Dockerfile+++ b/balena/manager.Dockerfile@@ -12,7 +12,7 @@ ENV TZ ${TZ:-Europe/Amsterdam}ENV OR_ADMIN_PASSWORD ${OR_ADMIN_PASSWORD:-secret}ENV OR_SETUP_TYPE ${OR_SETUP_TYPE}ENV OR_SSL_PORT ${OR_SSL_PORT:--1}-ENV OR_HOSTNAME ${OR_HOSTNAME:-localhost}+ENV OR_HOSTNAME ${OR_HOSTNAME:-127.0.0.1}ENV OR_EMAIL_HOST ${OR_EMAIL_HOST}ENV OR_EMAIL_USER ${OR_EMAIL_USER}ENV OR_EMAIL_PASSWORD ${OR_EMAIL_PASSWORD}@@ -83,7 +83,7 @@ ADD ./manager-build/map /opt/mapEXPOSE 8080EXPOSE 1883-HEALTHCHECK --interval=5s --timeout=60s --start-period=5s --retries=120 CMD curl --fail --silent http://localhost:8080 || exit 1+HEALTHCHECK --interval=5s --timeout=60s --start-period=5s --retries=120 CMD curl --fail --silent http://127.0.0.1:8080 || exit 1COPY entrypoint.sh /entrypoint.shRUN chmod +x /entrypoint.shdiff --git a/build.gradle b/build.gradleindex dfcdd6720..364684fd4 100644--- a/build.gradle+++ b/build.gradle@@ -266,6 +266,14 @@ tasks.named('clean') {}subprojects {+ // Search across all java projects for a runtime dependency e.g. ./gradlew insightRuntime --dependency my-dep+ plugins.withId('java') {+ tasks.register("insightRuntime", DependencyInsightReportTask) {+ configuration = configurations.runtimeClasspath+ showingAllVariants = false+ }+ }+// Apply only if the project has a 'test' tasktasks.withType(Test).configureEach { testTask ->outputs.upToDateWhen { false } // Always invalidate the test cachediff --git a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java b/container/src/main/java/org/openremote/container/persistence/PersistenceService.javaindex a32aa792b..8c0abcd66 100644--- a/container/src/main/java/org/openremote/container/persistence/PersistenceService.java+++ b/container/src/main/java/org/openremote/container/persistence/PersistenceService.java@@ -227,7 +227,7 @@ public class PersistenceService implements ContainerService, Consumer<Persistencpublic static final String OR_DB_VENDOR = "OR_DB_VENDOR";public static final String OR_DB_VENDOR_DEFAULT = Database.Product.POSTGRES.name();public static final String OR_DB_HOST = "OR_DB_HOST";- public static final String OR_DB_HOST_DEFAULT = "localhost";+ public static final String OR_DB_HOST_DEFAULT = "127.0.0.1";public static final String OR_DB_PORT = "OR_DB_PORT";public static final int OR_DB_PORT_DEFAULT = 5432;public static final String OR_DB_NAME = "OR_DB_NAME";diff --git a/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java b/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.javaindex 066b045e5..db7ac4446 100644--- a/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java+++ b/container/src/main/java/org/openremote/container/security/TokenVerifierImpl.java@@ -47,10 +47,13 @@ public class TokenVerifierImpl implements TokenVerifier {protected final String keycloakPublicUrl;protected final Map<String, JWTProcessor<SecurityContext>> processorCache =new ConcurrentHashMap<>();+ protected final boolean disableIssuerValidation;- public TokenVerifierImpl(String keycloakUrl, String keycloakPublicUrl) {+ public TokenVerifierImpl(+ String keycloakUrl, String keycloakPublicUrl, boolean disableIssuerValidation) {keyResolverService = new KeyResolver(keycloakUrl);this.keycloakPublicUrl = keycloakPublicUrl;+ this.disableIssuerValidation = disableIssuerValidation;}protected JWTProcessor<SecurityContext> getJwtProcessor(String realm) {@@ -77,12 +80,14 @@ public class TokenVerifierImpl implements TokenVerifier {JWTClaimsSetVerifier<SecurityContext> verifier =(claims, context) -> {- // Preserve Nimbus built-in checks for exp / nbf validation.+ // Preserve Nimbus built-in checks for exp / nbf validationdefaultClaimsVerifier.verify(claims, context);- // 1) issuer check (keep/remove depending on your policy)- if (claims.getIssuer() == null || !expectedIssuer.equals(claims.getIssuer())) {- throw new BadJWTException("Invalid token issuer");+ // Issuer check unless disabled+ if (!disableIssuerValidation) {+ if (claims.getIssuer() == null || !expectedIssuer.equals(claims.getIssuer())) {+ throw new BadJWTException("Invalid token issuer");+ }}// Keycloak uses azp to store client ID by default but we support aud for non keycloakdiff --git a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.javaindex d22eb8a85..3a9541489 100644--- a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java+++ b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakIdentityProvider.java@@ -18,16 +18,11 @@*/package org.openremote.container.security.keycloak;-import static org.openremote.model.Constants.*;import static org.openremote.model.Constants.MASTER_REALM;import static org.openremote.model.Constants.MASTER_REALM_ADMIN_USER;-import static org.openremote.model.util.MapAccess.getInteger;-import static org.openremote.model.util.MapAccess.getString;+import static org.openremote.model.util.MapAccess.*;-import io.undertow.server.HttpHandler;-import io.undertow.server.handlers.ResponseCodeHandler;-import io.undertow.server.handlers.proxy.LoadBalancingProxyClient;-import io.undertow.server.handlers.proxy.ProxyHandler;+import com.fasterxml.jackson.databind.JsonNode;import jakarta.security.enterprise.AuthenticationException;import jakarta.servlet.FilterRegistration;import jakarta.servlet.ServletContext;@@ -53,7 +48,6 @@ import org.keycloak.KeycloakPrincipal;import org.keycloak.KeycloakSecurityContext;import org.keycloak.admin.client.resource.RealmsResource;import org.openremote.container.security.*;-import org.openremote.container.web.WebService;import org.openremote.container.web.WebTargetBuilder;import org.openremote.model.Constants;import org.openremote.model.Container;@@ -61,6 +55,7 @@ import org.openremote.model.auth.OAuthClientCredentialsGrant;import org.openremote.model.auth.OAuthGrant;import org.openremote.model.auth.OAuthPasswordGrant;import org.openremote.model.util.TextUtil;+import org.openremote.model.util.VersionUtil;public abstract class KeycloakIdentityProvider implements IdentityProvider {@@ -80,20 +75,21 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {"security-admin-console");public static final String OR_KEYCLOAK_HOST = "OR_KEYCLOAK_HOST";- public static final String OR_KEYCLOAK_HOST_DEFAULT = "localhost";+ public static final String OR_KEYCLOAK_HOST_DEFAULT = "127.0.0.1";public static final String OR_KEYCLOAK_PORT = "OR_KEYCLOAK_PORT";public static final int OR_KEYCLOAK_PORT_DEFAULT = 8081;+ public static final String OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION =+ "OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION";public static final String OR_KEYCLOAK_PATH = "OR_KEYCLOAK_PATH";public static final String OR_KEYCLOAK_PATH_DEFAULT = "/auth";public static final String OIDC_CONFIG_PATH = "/realms/master/.well-known/openid-configuration";- public static final String KEYCLOAK_REQUEST_TIMEOUT = "KEYCLOAK_REQUEST_TIMEOUT";- public static final int KEYCLOAK_REQUEST_TIMEOUT_DEFAULT = 10000;public static final String OR_IDENTITY_SESSION_MAX_MINUTES = "OR_IDENTITY_SESSION_MAX_MINUTES";public static final int OR_IDENTITY_SESSION_MAX_MINUTES_DEFAULT = 60 * 24; // 1 daypublic static final String OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES ="OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES";public static final int OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES_DEFAULT = 2628000; // 5 yearsprivate static final Logger LOG = Logger.getLogger(KeycloakIdentityProvider.class.getName());+ public static final String KEYCLOAK_MIN_VERSION = "26.7.0";// The URI where Keycloak can be foundprotected UriBuilder keycloakServiceUri;// Configuration options for new realms@@ -101,13 +97,10 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {protected int sessionMaxSeconds;protected int sessionOfflineTimeoutSeconds;protected ResteasyWebTarget keycloakTarget;+ protected String keycloakPublicUri;protected OAuthGrant oAuthGrant;protected ConcurrentLinkedQueue<RealmsResource> realmsResourcePool =new ConcurrentLinkedQueue<>();- // Optional reverse proxy that listens to KEYCLOAK_AUTH_PATH and forwards requests to Keycloak- // (used in dev mode to allow same url to be used for manager and keycloak) - handled by proxy in- // production- protected HttpHandler authProxyHandler;protected TokenVerifier tokenVerifier;/**@@ -170,26 +163,21 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {LOG.info("Keycloak service URL: " + keycloakServiceUri.build());- if (container.isDevMode()) {- authProxyHandler =- ProxyHandler.builder()- .setProxyClient(new LoadBalancingProxyClient().addHost(keycloakServiceUri.build()))- .setMaxRequestTime(- getInteger(- container.getConfig(),- KEYCLOAK_REQUEST_TIMEOUT,- KEYCLOAK_REQUEST_TIMEOUT_DEFAULT))- .setNext(ResponseCodeHandler.HANDLE_404)- .setReuseXForwarded(true)- .build();+ String keycloakPublicUrl = getKeycloakPublicUrl();++ boolean disableIssuerValidation =+ getBoolean(container.getConfig(), OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION, false);++ if (disableIssuerValidation) {+ LOG.warning(+ "Token issuer validation disabled this should not be used for publicly exposed instances");}- // Get public URL of keycloak from the keycloak server- String keycloakPublicUrl = getKeycloakPublicUrl();tokenVerifier =new TokenVerifierImpl(keycloakServiceUri.build().toString(),- keycloakPublicUrl != null ? keycloakPublicUrl : keycloakServiceUri.build().toString());+ keycloakPublicUrl != null ? keycloakPublicUrl : keycloakServiceUri.build().toString(),+ disableIssuerValidation);}@Override@@ -235,6 +223,26 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {}}}++ // Verify the version of keycloak matches our requirements+ JsonNode serverInfo =+ keycloakTarget+ .path("admin/serverinfo")+ .request(MediaType.APPLICATION_JSON_TYPE)+ .get(JsonNode.class);+ String keycloakVersion = serverInfo.get("systemInfo").get("version").asText("0.0.0");+ if (!VersionUtil.isVersionGreaterOrEqual(keycloakVersion, KEYCLOAK_MIN_VERSION)) {+ String msg =+ "Keycloak version "+ + keycloakVersion+ + " is not supported; version "+ + KEYCLOAK_MIN_VERSION+ + " or newer is required.";+ LOG.severe(msg);+ throw new IllegalStateException(msg);+ }++ LOG.info("Keycloak version detected: " + keycloakVersion);}@Override@@ -341,14 +349,8 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {*/protected abstract OAuthGrant generateStoredCredentials(Container container);- protected void enableAuthProxy(WebService webService, String keycloakPath) {- if (authProxyHandler == null) throw new IllegalStateException("Initialize this service first");-- LOG.info(- "Enabling auth reverse proxy (passing requests through to Keycloak) on web context: /"- + keycloakPath);- webService.deploy(keycloakPath, authProxyHandler);- }+ /** Called by the Keycloak init setup task */+ public abstract void onSetupDone(Container container);/*** There must be _some_ valid redirect URIs for the application or authentication will not be@@ -445,7 +447,12 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {return tokenVerifier.verify(realm, accessToken);}+ /** Get public URL of keycloak from the keycloak server token endpoint issuer */protected String getKeycloakPublicUrl() {+ if (keycloakPublicUri != null) {+ return keycloakPublicUri;+ }+WebTarget webTarget =new WebTargetBuilder(WebTargetBuilder.getClient(), keycloakServiceUri.build()).build()@@ -475,8 +482,10 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {}// We want the base public URI not the master specific one- return result != null- ? result.issuer().replace("/realms/master", "")- : keycloakServiceUri.build().toString();+ keycloakPublicUri =+ result != null+ ? result.issuer().replace("/realms/master", "")+ : keycloakServiceUri.build().toString();+ return keycloakPublicUri;}}diff --git a/container/src/main/java/org/openremote/container/web/OAuthFilter.java b/container/src/main/java/org/openremote/container/web/OAuthFilter.javaindex 3865c8805..d388eb2d3 100644--- a/container/src/main/java/org/openremote/container/web/OAuthFilter.java+++ b/container/src/main/java/org/openremote/container/web/OAuthFilter.java@@ -78,7 +78,7 @@ public class OAuthFilter implements ClientRequestFilter {}protected synchronized void updateToken() throws SocketException {- LOG.finest("Updating OAuth token: " + oAuthGrant.getTokenEndpointUri());+ LOG.finer("Updating OAuth token: " + oAuthGrant.getTokenEndpointUri());Response response = null;try {@@ -101,12 +101,11 @@ public class OAuthFilter implements ClientRequestFilter {if (response.getStatusInfo().getFamily() != Response.Status.Family.SUCCESSFUL) {authServerResponse = null;- LOG.fine(- "OAuth server response error '"- + response.getStatus()- + "': "- + oAuthGrant.getTokenEndpointUri());- throw new RuntimeException("OAuth server response error: " + response.getStatus());+ String error = response.readEntity(String.class);+ String msg =+ "OAuth server response error: status=" + response.getStatus() + ", msg=" + error;+ LOG.finer(msg);+ throw new RuntimeException(msg);} else {authServerResponse = response.readEntity(OAuthServerResponse.class);LOG.finest("OAuth server successfully returned an access token");diff --git a/docker-compose.yml b/docker-compose.ymlindex 3ff3e8aa1..c6a9503d0 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -1,6 +1,6 @@# OpenRemote v3#-# Profile that runs the stack by default on https://localhost using a self-signed SSL certificate,+# Profile that runs the stack by default on the docker host port 443 using HTTPS with a self-signed SSL certificate,# but optionally on https://$OR_HOSTNAME with an auto generated SSL certificate from Letsencrypt.## It is configured to use the AWS logging driver.@@ -21,7 +21,7 @@ services:- "80:80" # Needed for SSL generation using letsencrypt- "${OR_SSL_PORT:-443}:443"- "8883:8883"- - "127.0.0.1:8404:8404" # Localhost metrics access+ - "127.0.0.1:8404:8404" # Local metrics access- "${PRIVATE_IP:-127.0.0.1}:8404:8404" # Allows to also expose metrics on a given IP address,# intended to be IP of the interface of the private subnet of the EC2 VMvolumes:@@ -50,9 +50,8 @@ services:volumes:- ./deployment:/deploymentenvironment:- KEYCLOAK_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD:-secret}- KC_HOSTNAME: ${OR_HOSTNAME:-localhost}- KC_HOSTNAME_PORT: ${OR_SSL_PORT:--1}+ KC_BOOTSTRAP_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD:-secret}+ KC_HOSTNAME: https://${OR_HOSTNAME:-localhost}/authmanager:# privileged: true@@ -62,7 +61,7 @@ services:keycloak:condition: service_healthyports:- - "127.0.0.1:8405:8405" # Localhost metrics access+ - "127.0.0.1:8405:8405" # Local metrics access- "${PRIVATE_IP:-127.0.0.1}:8405:8405" # Allows to also expose metrics on a given IP address,# intended to be IP of the interface of the private subnet of the EC2 VMenvironment:diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 485055ea1..ae2fcf67c 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -45,7 +45,8 @@ jdom = "2.0.6.1"jserialcomm = "2.11.4"jsonassert = "1.5.3"junit = "6.1.3"-keycloak = "25.0.3"+keycloakAdminClient = "26.0.10"+keycloakCore = "26.6.4"micrometer = "1.17.0"mockito = "5.23.0"netty = "4.2.17.Final"@@ -148,8 +149,8 @@ jsonassert = { module = "org.skyscreamer:jsonassert", version.ref = "jsonassert"junitJupiterApi = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" }junitJupiterEngine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" }junitJupiterParams = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" }-keycloakAdminClient = { module = "org.keycloak:keycloak-admin-client", version.ref = "keycloak" }-keycloakCore = { module = "org.keycloak:keycloak-core", version.ref = "keycloak" }+keycloakAdminClient = { module = "org.keycloak:keycloak-admin-client", version.ref = "keycloakAdminClient" }+keycloakCore = { module = "org.keycloak:keycloak-core", version.ref = "keycloakCore" }micrometerCore = { module = "io.micrometer:micrometer-core", version.ref = "micrometer" }micrometerRegistryPrometheus = { module = "io.micrometer:micrometer-registry-prometheus", version.ref = "micrometer" }mockitoCore = { module = "org.mockito:mockito-core", version.ref = "mockito" }diff --git a/kubernetes/README.md b/kubernetes/README.mdindex a2576aed7..ee52dadc0 100644--- a/kubernetes/README.md+++ b/kubernetes/README.md@@ -97,13 +97,12 @@ The most important configuration information has been exposed in the helm valuesIt is sometimes necessary to provide more configuration to the containers.This is done through environment variables, as it was done before with docker compose.In the values files, there is `or.env` property available to define any environment variable that will get passed to the container.-For instance, this snippet of a values files defines a value for the KC_HOSTNAME_STRICT_HTTPS environment variable passed to the keycloak container.-Important: the value always needs to be enclosed in double quotes, even for boolean or numeric values.+For example the following sets `MY_VARIABLE=false` (NOTE: the value always needs to be enclosed in double quotes, even for boolean or numeric values).```yamlor:env:- - name: KC_HOSTNAME_STRICT_HTTPS+ - name: MY_VARIABLEvalue: "false"```diff --git a/kubernetes/keycloak/templates/deployment.yaml b/kubernetes/keycloak/templates/deployment.yamlindex 017913473..f7662ef08 100644--- a/kubernetes/keycloak/templates/deployment.yaml+++ b/kubernetes/keycloak/templates/deployment.yaml@@ -67,9 +67,7 @@ spec:value: "{{ .Values.or.postgresql.poolMaxSize }}"- name: KC_HOSTNAMEvalue: "{{ .Values.or.hostname }}"- - name: KC_HOSTNAME_PORT- value: "{{ .Values.or.port }}"- - name: KEYCLOAK_ADMIN_PASSWORD+ - name: KC_BOOTSTRAP_ADMIN_PASSWORDvalueFrom:secretKeyRef:name: openremote-secretdiff --git a/kubernetes/keycloak/values-dev.yaml b/kubernetes/keycloak/values-dev.yamlindex 8ec160f6b..6d432f5c9 100644--- a/kubernetes/keycloak/values-dev.yaml+++ b/kubernetes/keycloak/values-dev.yaml@@ -1,5 +1,2 @@or:- env:- - name: KC_HOSTNAME_STRICT_HTTPS- value: "false"port: "8080"diff --git a/manager/Dockerfile b/manager/Dockerfileindex 07ee4f11f..f5a5d2119 100644--- a/manager/Dockerfile+++ b/manager/Dockerfile@@ -97,6 +97,12 @@ ENV OR_KEYCLOAK_PORT=${OR_KEYCLOAK_PORT}ARG OR_KEYCLOAK_GRANT_FILE=manager/keycloak-credentials.jsonENV OR_KEYCLOAK_GRANT_FILE=${OR_KEYCLOAK_GRANT_FILE}+ARG OR_KEYCLOAK_PUBLIC_URI=/auth+ENV OR_KEYCLOAK_PUBLIC_URI=${OR_KEYCLOAK_PUBLIC_URI}++ARG OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION+ENV OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION=false+ARG OR_APP_DOCROOT=/opt/webENV OR_APP_DOCROOT=${OR_APP_DOCROOT}@@ -136,6 +142,9 @@ ENV OR_IDENTITY_SESSION_MAX_MINUTES=${OR_IDENTITY_SESSION_MAX_MINUTES}ARG OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES=2628000ENV OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES=${OR_IDENTITY_SESSION_OFFLINE_TIMEOUT_MINUTES}+ARG OR_KEYCLOAK_PUBLIC_URI=/auth+ENV OR_KEYCLOAK_PUBLIC_URI=${OR_KEYCLOAK_PUBLIC_URI}+ARG OR_ATTRIBUTE_EVENT_THREADSENV OR_ATTRIBUTE_EVENT_THREADS=${OR_ATTRIBUTE_EVENT_THREADS}diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.javaindex 1628d42b3..594af4655 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientConnector.java@@ -23,6 +23,8 @@ import static org.openremote.manager.gateway.GatewayConnector.ASSET_READ_EVENT_Nimport static org.openremote.model.syslog.SyslogCategory.GATEWAY;import io.netty.channel.ChannelHandler;+import java.net.URI;+import java.net.URISyntaxException;import java.time.Duration;import java.util.*;import java.util.concurrent.CompletableFuture;@@ -180,16 +182,7 @@ public class GatewayClientConnector implements AutoCloseable {.build(),null,new OAuthClientCredentialsGrant(- new URIBuilder()- .setScheme(connection.isSecured() ? "https" : "http")- .setHost(connection.getHost())- .setPort(connection.getPort() == null ? -1 : connection.getPort())- .setPath(- "auth/realms/"- + connection.getRealm()- + "/protocol/openid-connect/token")- .build()- .toString(),+ getAuthTokenEndpoint(),connection.getClientId(),connection.getClientSecret(),null)@@ -231,6 +224,19 @@ public class GatewayClientConnector implements AutoCloseable {return null;}+ protected String getAuthTokenEndpoint() throws URISyntaxException, IllegalArgumentException {+ if (connection.getTokenEndpointURI() != null) {+ return URI.create(connection.getTokenEndpointURI()).toString();+ }+ return new URIBuilder()+ .setScheme(connection.isSecured() ? "https" : "http")+ .setHost(connection.getHost())+ .setPort(connection.getPort() == null ? -1 : connection.getPort())+ .setPath("auth/realms/" + connection.getRealm() + "/protocol/openid-connect/token")+ .build()+ .toString();+ }+protected CompletableFuture<Void> doInit() {// Clear gateway API versiongatewayAPIVersion = null;diff --git a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.javaindex c5faaf0e8..4f4809fd1 100644--- a/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java+++ b/manager/src/main/java/org/openremote/manager/gateway/GatewayClientService.java@@ -149,16 +149,7 @@ public class GatewayClientService extends RouteBuilder implements ContainerServi.getResultList()).stream().collect(- Collectors.toMap(- GatewayConnection::getLocalRealm,- connection ->- new GatewayClientConnector(- connection,- tunnelFactory,- clientEventService,- timerService,- assetStorageService,- assetProcessingService))));+ Collectors.toMap(GatewayConnection::getLocalRealm, this::createClientConnector)));}@Override@@ -210,18 +201,22 @@ public class GatewayClientService extends RouteBuilder implements ContainerServi}if (cause != PersistenceEvent.Cause.DELETE) {- return new GatewayClientConnector(- connection,- tunnelFactory,- clientEventService,- timerService,- assetStorageService,- assetProcessingService);+ return createClientConnector(connection);}return null;});}+ protected GatewayClientConnector createClientConnector(GatewayConnection connection) {+ return new GatewayClientConnector(+ connection,+ tunnelFactory,+ clientEventService,+ timerService,+ assetStorageService,+ assetProcessingService);+ }+/** GATEWAY RESOURCE METHODS */protected List<GatewayConnection> getConnections() {return connectionRealmMap.values().stream().map(GatewayClientConnector::getConnection).toList();diff --git a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.javaindex 804fd40a2..aab94d610 100644--- a/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java+++ b/manager/src/main/java/org/openremote/manager/security/ManagerKeycloakIdentityProvider.java@@ -52,6 +52,7 @@ import org.keycloak.admin.client.resource.RealmResource;import org.keycloak.admin.client.resource.UserResource;import org.keycloak.common.enums.SslRequired;import org.keycloak.representations.idm.*;+import org.keycloak.representations.userprofile.config.UPConfig;import org.openremote.container.message.MessageBrokerService;import org.openremote.container.persistence.PersistenceService;import org.openremote.container.security.AuthContext;@@ -94,7 +95,6 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderpublic static final String OR_KEYCLOAK_GRANT_FILE = "OR_KEYCLOAK_GRANT_FILE";public static final String OR_KEYCLOAK_GRANT_FILE_DEFAULT = "manager/keycloak-credentials.json";public static final String OR_KEYCLOAK_PUBLIC_URI = "OR_KEYCLOAK_PUBLIC_URI";- public static final String OR_KEYCLOAK_PUBLIC_URI_DEFAULT = "/auth";public static final String OR_KEYCLOAK_ENABLE_DIRECT_ACCESS_GRANT ="OR_KEYCLOAK_ENABLE_DIRECT_ACCESS_GRANT";public static final int REALM_CACHE_EXPIRY_MINS = 10;@@ -124,8 +124,15 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderDuration.ofMinutes(container.isDevMode() ? 0 : REALM_CACHE_EXPIRY_MINS)).build();- String keycloakPublicUri =- getString(container.getConfig(), OR_KEYCLOAK_PUBLIC_URI, OR_KEYCLOAK_PUBLIC_URI_DEFAULT);+ String keycloakPublicUri = getString(container.getConfig(), OR_KEYCLOAK_PUBLIC_URI, null);+ if (TextUtil.isNullOrEmpty(keycloakPublicUri)) {+ // Use full public URI from keycloak backend - in our docker image this is set to '/auth'+ // indicating that+ // keycloak is available on the same hostname port and schema as the manager - needed for+ // gateway tunnelling+ // scenarios specifically+ keycloakPublicUri = getKeycloakPublicUrl();+ }try {URIBuilder uriBuilder = new URIBuilder(keycloakPublicUri);frontendURI = uriBuilder.build().toString();@@ -150,16 +157,6 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderWebService.getExternalHostnames().stream().map(host -> "https://" + host + "/*").toList());}- @Override- public void start(Container container) {- super.start(container);- if (container.isDevMode()) {- String keycloakPath =- getString(container.getConfig(), OR_KEYCLOAK_PATH, OR_KEYCLOAK_PATH_DEFAULT);- enableAuthProxy(container.getService(WebService.class), keycloakPath);- }- }-@Overrideprotected OAuthGrant getStoredCredentials(Container container) {// Try and load keycloak proxy credentials from the file system@@ -236,6 +233,17 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider}}+ // TODO: Remove this once #3156 is implemented+ @Override+ public void onSetupDone(Container container) {+ // Need to add the attribute to the keycloak user now the master realm is properly configured+ User keycloakProxyUser = getUserByUsername(MASTER_REALM, MANAGER_CLIENT_ID);+ if (keycloakProxyUser != null) {+ keycloakProxyUser.setSystemAccount(true);+ createUpdateUser(MASTER_REALM, keycloakProxyUser, null, true);+ }+ }+@Overrideprotected void addClientRedirectUris(String client, List<String> redirectUrls, boolean devMode) {// Callback URL used by Manager web client authentication, any relative path to "ourselves" is@@ -439,12 +447,21 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvideruserRepresentation = convert(user, UserRepresentation.class);RealmResource realmResource = realmsResource.realm(realm);- Response response = realmResource.users().create(userRepresentation);- String location = response.getHeaderString(Headers.LOCATION_STRING);- response.close();- if (!response.getStatusInfo().equals(Response.Status.CREATED)- || TextUtil.isNullOrEmpty(location)) {- throw new BadRequestException("Failed to create user: User=" + user);+ String location;+ String error = null;+ Response.StatusType status;++ try (Response response = realmResource.users().create(userRepresentation)) {+ location = response.getHeaderString(Headers.LOCATION_STRING);+ status = response.getStatusInfo();+ if (!status.equals(Response.Status.CREATED) || TextUtil.isNullOrEmpty(location)) {+ error = response.readEntity(String.class);+ }+ }++ if (!status.equals(Response.Status.CREATED) || TextUtil.isNullOrEmpty(location)) {+ throw new BadRequestException(+ "Failed to create user: User=" + user + ", Error=" + error);}String[] locationArr = location.split("/");String userId = locationArr.length > 0 ? locationArr[locationArr.length - 1] : null;@@ -1054,7 +1071,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderrealmRepresentation.setPasswordPolicy(realm.getPasswordPolicyString());realmRepresentation.setNotBefore(realm.getNotBefore() != null ? realm.getNotBefore().intValue() : null);- configureRealm(realmRepresentation);+ configureRealm(realmRepresentation, realmResource);realmResource.update(realmRepresentation);realmCache.invalidate(realm.getName());@@ -1119,7 +1136,7 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderrealmRepresentation = realmResource.toRepresentation();// Need a committed realmRepresentation to update the security- configureRealm(realmRepresentation);+ configureRealm(realmRepresentation, realmResource);realmResource.update(realmRepresentation);// Create realm roles inserting@@ -1140,6 +1157,15 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderrealmRole.getName(), realmRole.getDescription(), false));});+ // Since Keycloak 26.7.0 Verify Profile is enabled for new realms but not the master+ // realm+ RequiredActionProviderRepresentation requiredActionConfigRepresentation =+ realmResource.flows().getRequiredAction("VERIFY_PROFILE");+ requiredActionConfigRepresentation.setEnabled(false);+ realmResource+ .flows()+ .updateRequiredAction("VERIFY_PROFILE", requiredActionConfigRepresentation);+// Auto create the standard openremote clientClientRepresentation clientRepresentation = generateOpenRemoteClientRepresentation();createUpdateClient(realm.getName(), clientRepresentation);@@ -1548,7 +1574,8 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProviderreturn frontendURI;}- protected void configureRealm(RealmRepresentation realmRepresentation) {+ protected void configureRealm(+ RealmRepresentation realmRepresentation, RealmResource realmResource) {realmRepresentation.setAccessTokenLifespan(Constants.ACCESS_TOKEN_LIFESPAN_SECONDS);@@ -1580,6 +1607,15 @@ public class ManagerKeycloakIdentityProvider extends KeycloakIdentityProvider// Service-internal network (between manager and keycloak service containers) does not use SSLrealmRepresentation.setSslRequired(SslRequired.NONE.toString());+ // Internationalization must be enabled for locale attribute to be persisted+ realmRepresentation.setInternationalizationEnabled(true);++ // Since Keycloak 26.7.0 Unmanaged user attributes are disabled for all realms+ UserProfileResource userProfileResource = realmResource.users().userProfile();+ UPConfig upConfig = userProfileResource.getConfiguration();+ upConfig.setUnmanagedAttributePolicy(UPConfig.UnmanagedAttributePolicy.ADMIN_EDIT);+ userProfileResource.update(upConfig);+// Configure SMTPString host = container.getConfig().getOrDefault(OR_EMAIL_HOST, null);if (!TextUtil.isNullOrEmpty(host)diff --git a/manager/src/main/java/org/openremote/manager/setup/KeycloakInitSetup.java b/manager/src/main/java/org/openremote/manager/setup/KeycloakInitSetup.javaindex b10043717..a0b1f2ced 100644--- a/manager/src/main/java/org/openremote/manager/setup/KeycloakInitSetup.java+++ b/manager/src/main/java/org/openremote/manager/setup/KeycloakInitSetup.java@@ -63,5 +63,7 @@ public class KeycloakInitSetup extends AbstractKeycloakSetup {KEYCLOAK_CLIENT_ID,ClientRole.READ.getValue(),ClientRole.WRITE.getValue());++ keycloakProvider.onSetupDone(container);}}diff --git a/manager/src/main/java/org/openremote/manager/setup/database/AbstractKeycloakMigration.java b/manager/src/main/java/org/openremote/manager/setup/database/AbstractKeycloakMigration.javaindex 7152bbc87..7eb3f5399 100644--- a/manager/src/main/java/org/openremote/manager/setup/database/AbstractKeycloakMigration.java+++ b/manager/src/main/java/org/openremote/manager/setup/database/AbstractKeycloakMigration.java@@ -18,6 +18,7 @@*/package org.openremote.manager.setup.database;+import jakarta.ws.rs.WebApplicationException;import jakarta.ws.rs.core.UriBuilder;import java.nio.charset.StandardCharsets;import java.nio.file.Files;@@ -66,12 +67,39 @@ public abstract class AbstractKeycloakMigration extends BaseJavaMigration {protected Keycloak openKeycloak() {OAuthPasswordGrant credentials = resolveCredentials();- return Keycloak.getInstance(- buildKeycloakUrl(),- Constants.MASTER_REALM,- credentials.getUsername(),- credentials.getPassword(),- KeycloakIdentityProvider.ADMIN_CLI_CLIENT_ID);+ Keycloak keycloak =+ Keycloak.getInstance(+ buildKeycloakUrl(),+ Constants.MASTER_REALM,+ credentials.getUsername(),+ credentials.getPassword(),+ KeycloakIdentityProvider.ADMIN_CLI_CLIENT_ID);++ try {+ keycloak.tokenManager().grantToken();+ } catch (WebApplicationException e) {+ String msg = "Unknown error";+ if (e.getResponse().hasEntity()) {+ msg = e.getResponse().readEntity(String.class);+ e.getResponse().close();+ }+ LOG.warning("Failed to connect to Keycloak: error=" + msg);+ keycloak.close();++ // Falling back to admin credentials+ LOG.warning("Falling back to admin credentials");+ credentials = loadAdminFallbackCredentials();++ keycloak =+ Keycloak.getInstance(+ buildKeycloakUrl(),+ Constants.MASTER_REALM,+ credentials.getUsername(),+ credentials.getPassword(),+ KeycloakIdentityProvider.ADMIN_CLI_CLIENT_ID);+ }++ return keycloak;}/**diff --git a/model/src/main/java/org/openremote/model/gateway/GatewayConnection.java b/model/src/main/java/org/openremote/model/gateway/GatewayConnection.javaindex 1333cc30f..47285ab41 100644--- a/model/src/main/java/org/openremote/model/gateway/GatewayConnection.java+++ b/model/src/main/java/org/openremote/model/gateway/GatewayConnection.java@@ -20,10 +20,7 @@ package org.openremote.model.gateway;import com.fasterxml.jackson.annotation.JsonCreator;import io.swagger.v3.oas.annotations.media.Schema;-import jakarta.persistence.Column;-import jakarta.persistence.Entity;-import jakarta.persistence.Id;-import jakarta.persistence.Table;+import jakarta.persistence.*;import jakarta.validation.constraints.Max;import jakarta.validation.constraints.Min;import jakarta.validation.constraints.NotNull;@@ -99,6 +96,12 @@ public class GatewayConnection {@Schema(description = "Synchronization rules keyed by asset type; use * as a wildcard.")protected Map<String, GatewayAssetSyncRule> assetSyncRules;+ /**+ * This is currently used in testing, but we may want to support a different token endpoint URI+ * for gateways in the future+ */+ @Transient protected String tokenEndpointURI;+/** For JPA */protected GatewayConnection() {}@@ -229,6 +232,10 @@ public class GatewayConnection {return this;}+ public String getTokenEndpointURI() {+ return tokenEndpointURI;+ }+@Overridepublic String toString() {return getClass().getSimpleName()diff --git a/model/src/main/java/org/openremote/model/security/Realm.java b/model/src/main/java/org/openremote/model/security/Realm.javaindex a40c0cb61..d9523cf89 100644--- a/model/src/main/java/org/openremote/model/security/Realm.java+++ b/model/src/main/java/org/openremote/model/security/Realm.java@@ -30,7 +30,6 @@ import jakarta.validation.constraints.Pattern;import jakarta.validation.constraints.Size;import java.io.IOException;import java.util.*;-import org.hibernate.annotations.Formula;import org.hibernate.annotations.Subselect;import org.openremote.model.persistence.PasswordPolicyConverter;@@ -70,8 +69,7 @@ public class Realm {@Schema(description = "Stable realm name used in API paths and tokens.", example = "building")protected String name;- @Formula(- "(select ra.VALUE from PUBLIC.REALM_ATTRIBUTE ra where ra.REALM_ID = ID and ra.name = 'displayName')")+ @Column(name = "DISPLAY_NAME")@Schema(description = "Human-readable realm label.", example = "Building Management")protected String displayName;diff --git a/model/src/main/java/org/openremote/model/security/User.java b/model/src/main/java/org/openremote/model/security/User.javaindex c085760f7..f96f08c3c 100644--- a/model/src/main/java/org/openremote/model/security/User.java+++ b/model/src/main/java/org/openremote/model/security/User.java@@ -337,6 +337,9 @@ public class User {+ '\''+ ", enabled="+ enabled+ + '\''+ + ", attributes="+ + (attributes != null ? Arrays.toString(attributes.toArray()) : "")+ '}';}}diff --git a/model/src/main/java/org/openremote/model/security/UserAttribute.java b/model/src/main/java/org/openremote/model/security/UserAttribute.javaindex 6f8b7dcc7..de452281a 100644--- a/model/src/main/java/org/openremote/model/security/UserAttribute.java+++ b/model/src/main/java/org/openremote/model/security/UserAttribute.java@@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonCreator;import jakarta.persistence.Column;import jakarta.persistence.Entity;import jakarta.persistence.Id;+import java.util.Objects;import org.hibernate.annotations.Subselect;@Entity@@ -53,4 +54,33 @@ public class UserAttribute {public String getValue() {return value;}++ @Override+ public boolean equals(Object o) {+ if (o == null || getClass() != o.getClass()) return false;+ UserAttribute that = (UserAttribute) o;+ return Objects.equals(id, that.id)+ && Objects.equals(name, that.name)+ && Objects.equals(value, that.value);+ }++ @Override+ public int hashCode() {+ return Objects.hash(id, name, value);+ }++ @Override+ public String toString() {+ return "UserAttribute{"+ + "id='"+ + id+ + '\''+ + ", name='"+ + name+ + '\''+ + ", value='"+ + value+ + '\''+ + '}';+ }}diff --git a/profile/demo.yml b/profile/demo.ymlindex 66dddb0c2..99ceb960a 100644--- a/profile/demo.yml+++ b/profile/demo.yml@@ -86,10 +86,7 @@ services:volumes:- ../deployment:/deploymentenvironment:- KEYCLOAK_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}- KC_HOSTNAME: ${OR_HOSTNAME:-localhost}- KC_HOSTNAME_PORT: ${OR_SSL_PORT:--1}- KC_LOG_CONSOLE_FORMAT: "%-5p [%c] (%t) %s%e%n"+ KC_BOOTSTRAP_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}<<: *awslogsmanager:diff --git a/profile/deploy.yml b/profile/deploy.ymlindex ce188ac1e..f957808bb 100644--- a/profile/deploy.yml+++ b/profile/deploy.yml@@ -32,7 +32,7 @@ services:# /etc/haproxy/certs (note custom certificates must include the full chain including the private key). Can also volume# map a custom proxy config file.proxy:- image: openremote/proxy:${PROXY_VERSION:-latest}+ image: openremote/proxy:${PROXY_VERSION:-develop}restart: always# volumes:# - proxy-data:/deployment@@ -50,7 +50,7 @@ services:# IANA TLD subdomain for which an SSL certificate should be requested (leave blank for private/externally# generated certificates).- DOMAINNAME: ${OR_HOSTNAME:-localhost}+ DOMAINNAME: ${OR_HOSTNAME:-127.0.0.1}# IANA TLD comma separated subdomains for which an SSL certificates should be requested (leave blank for# private/externally generated certificates); this is an alternative to DOMAINNAME for multiple domains.@@ -109,7 +109,7 @@ services:- "80:80" # HTTP for letsencrypt cert generation and in general it redirects to 443 for HTTPS- "${OR_SSL_PORT:-443}:443" # HTTPS /auth directs to keycloak and other paths direct to manager- "8883:8883" # MQTTS- - "127.0.0.1:8404:8404" # Localhost metrics access+ - "127.0.0.1:8404:8404" # Local metrics access- "${PRIVATE_IP:-127.0.0.1}:8404:8404" # Allows to also expose metrics on a given IP address,# intended to be IP of the interface of the private subnet of the EC2 VM@@ -136,7 +136,7 @@ services:# - "8080:8080" # Web server port# - "8000:8000" # Remote debugging port - NOT FOR PRODUCTION USE!!!# - "8085:8085" # JMX port - FOR DIAGNOSTICS ONLY!!!- # - "127.0.0.1:8405:8405" # Localhost metrics access+ # - "127.0.0.1:8405:8405" # Local metrics access# - "${PRIVATE_IP:-127.0.0.1}:8405:8405" # Allows to also expose metrics on a given IP address,# intended to be IP of the interface of the private subnet of the EC2 VMlogging:@@ -165,7 +165,7 @@ services:# The public HOSTNAME and SSL PORT of this managerOR_SSL_PORT: ${OR_SSL_PORT:--1}- OR_HOSTNAME: ${OR_HOSTNAME:-localhost}+ OR_HOSTNAME: ${OR_HOSTNAME:-127.0.0.1}# Additional hostnames that should be allowed to access the auth serverOR_ADDITIONAL_HOSTNAMES:@@ -201,7 +201,7 @@ services:OR_GATEWAY_TUNNEL_TCP_START: # First TCP port that can be allocated for raw TCP connections (should be start of an assigned contiguous block e.g. 9000-10000 = 9000)# Configure the edge instance for Gateway SSH tunnelling (if SSH_KEY_FILE is set ten gateway tunnelling support is enabled on te edge instance)OR_GATEWAY_TUNNEL_SSH_KEY_FILE: # SSH key file in RSA (not openSSH) format (use ssh-keygen -p -f ~/.ssh/id_rsa -m pem) to convert from openSSH- OR_GATEWAY_TUNNEL_LOCALHOST_REWRITE: # Override default rewriting of localhost tunnelling to work within Docker+ OR_GATEWAY_TUNNEL_LOCALHOST_REWRITE: # Override default rewriting of localhost/127.0.0.1 tunnelling to work within Docker# Developer mode (see code for usages of OR_DEV_MODE flag)OR_DEV_MODE: ${OR_DEV_MODE:-false}@@ -258,6 +258,9 @@ services:# Keycloak public URI (only set this if keycloak is not on the same base URI as the manager i.e. not accessible at /auth)OR_KEYCLOAK_PUBLIC_URI:+ # Disable keycloak issuer validation, set this on edge gateway instances for tunneling to work (DO NOT USE THIS SETTING IN PUBLICLY EXPOSED DEPLOYMENTS)+ OR_KEYCLOAK_DISABLE_ISSUER_VALIDATION:+# Location of built in web content.OR_APP_DOCROOT: ${OR_APP_DOCROOT:-/opt/web}@@ -369,20 +372,18 @@ services:# THE FOLLOWING OPTIONS CAN BE USED TO ENABLE JMX; PORT MUST ALSO BE EXPOSED# ACCESS SHOULD BE RESTRICTED BY FIREWALL TO SPECIFIC IPs FOR DIAGNOSTIC PURPOSES#- #JAVA_TOOL_OPTIONS: -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=${OR_HOSTNAME:-localhost}+ #JAVA_TOOL_OPTIONS: -Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=${OR_HOSTNAME:-127.0.0.1}## Custom JVM tool options (for remote debugging)#JAVA_TOOL_OPTIONS: '-agentlib:jdwp=transport=dt_socket,address=0.0.0.0:8000,server=y,suspend=n'# Keycloak identity providerkeycloak:- image: openremote/keycloak:${KEYCLOAK_VERSION:-latest}+ image: openremote/keycloak:${KEYCLOAK_VERSION:-develop}restart: always- # Map any custom themes into the /deployment/keycloak/themes dir:#volumes:- # Map custom themes- # - ../deployment:/deployment- # - deployment-data:/deployment+ # Map custom themes for theme development+ # - /path/to/theme/src/main/resources/theme/openremote:/opt/keycloak/themes/dev#ports:# - "8081:8080" # Web server portenvironment:@@ -404,27 +405,21 @@ services:KC_DB_POOL_MIN_SIZE:KC_DB_POOL_MAX_SIZE: ${KC_DB_POOL_MAX_SIZE:-20}- # Configure web server- KC_HOSTNAME: ${OR_HOSTNAME:-localhost}- KC_HOSTNAME_PORT: ${OR_SSL_PORT:--1}- #KC_HOSTNAME_PATH: ${KC_HOSTNAME_PATH:-auth}+ # Configure web server (Can be a full URL, or just a hostname. When only hostname is provided, scheme, port and context path are resolved from the request)+ #KC_HOSTNAME: https://${OR_HOSTNAME:-127.0.0.1}/auth+ # Set this on edge gateway instances for tunneling to work (DO NOT USE THIS SETTING IN PUBLICLY EXPOSED DEPLOYMENTS)+ KC_HOSTNAME_STRICT: false+ KC_HOSTNAME_DEBUG: true+ # Set the following for edge gateways not directly exposed to the internet+ #KC_HOSTNAME_STRICT: false#KC_HOSTNAME_ADMIN: ${KC_HOSTNAME_ADMIN:-}#KC_HTTP_ENABLED: ${KC_HTTP_ENABLED:-true}#KC_PROXY_HEADERS: ${KC_PROXY_HEADERS:-xforwarded}- #KC_PROXY: ${KC_PROXY:-edge}# Configure main user credentials (only on first startup)- KEYCLOAK_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD:-secret}+ KC_BOOTSTRAP_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD:-secret}# Custom startup options (see keycloak documentation)KEYCLOAK_START_COMMAND:KEYCLOAK_START_OPTS:- # Default themes to use- KEYCLOAK_DEFAULT_THEME: ${KEYCLOAK_DEFAULT_THEME:-openremote}- KEYCLOAK_ACCOUNT_THEME: ${KEYCLOAK_ACCOUNT_THEME:-openremote}- KEYCLOAK_WELCOME_THEME: ${KEYCLOAK_WELCOME_THEME:-keycloak}- # Use the following to set the issuer to a fixed value (useful when accessing a private instance via a tunnel)- # Should also set KC_HOSTNAME to blank, KC_HOSTNAME_STRICT to false and if the keycloak instance is publicly- # exposed then the proxy should be configured to validate the host header to prevent abuse- #KEYCLOAK_ISSUER_BASE_URI: 'https://192.168.1.2/auth'# Configuration for roles to be assigned to self-registered users (when the listener is enabled)# Example is "{\"realmRoles\":[\"restricted_user\"],\"clientRoles\":[{\"client\":\"openremote\",\"roles\":[\"read:assets\",\"write:attributes\"]}]}"@@ -435,7 +430,7 @@ services:# PostgreSQL DBMSpostgresql:- image: openremote/postgresql:${POSTGRESQL_VERSION:-latest-slim}+ image: openremote/postgresql:${POSTGRESQL_VERSION:-develop-slim}restart: always# RAM limits and PostgreSQL memory settings should be set appropriately for the expected load (see documentation)shm_size: ${OR_DB_SHM:-156mb}@@ -489,7 +484,7 @@ services:# Config file should be at: /deployment/query-exporter/config.yaml- deployment-data:/deploymentports:- - "127.0.0.1:8406:9560" # Localhost metrics access+ - "127.0.0.1:8406:9560" # Local metrics access- "${PRIVATE_IP:-127.0.0.1}:8406:9560" # Allows to also expose metrics on a given IP address,# intended to be IP of the interface of the private subnet of the EC2 VMenvironment:diff --git a/profile/dev-proxy.yml b/profile/dev-proxy.ymlindex 5a5dc247d..4ed80c6ef 100644--- a/profile/dev-proxy.yml+++ b/profile/dev-proxy.yml@@ -1,12 +1,7 @@# OpenRemote v3#-# Profile for running the reverse proxy on https://localhost/ with the manager backend mapped to the host machine on-# localhost:8080 and the keycloak backend mapped to the host machine on localhost:8081-#-# Your changes will be visible live on browser reload or after restart:-#-# - Run the manager in an IDE with the following required environment variables:-# OR_WEBSERVER_LISTEN_HOST=0.0.0.0+# Profile for running the reverse proxy on https://127.0.0.1/ with the manager backend mapped to the host machine on+# 127.0.0.1:8080 and the keycloak backend mapped to the host machine on 127.0.0.1:8081## Please see deploy.yml for configuration details for each service.#@@ -19,7 +14,7 @@ services:file: deploy.ymlservice: proxyenvironment:- MANAGER_HOST: ${MANAGER_HOST:-'host.docker.internal'}+ MANAGER_HOST: ${MANAGER_HOST:-host.docker.internal}# Uncomment to use sish in development#SISH_HOST: sish#SISH_PORT: 8090@@ -28,18 +23,8 @@ services:extends:file: deploy.ymlservice: keycloak- #volumes:- # Map custom themes- # - ../deployment:/deployment- # Access directly if needed on localhostports:- "8081:8080"- # Following options are useful for tunnelling functionality do not use on public instance- environment:- KEYCLOAK_ISSUER_BASE_URI: https://localhost/auth- KC_HOSTNAME_STRICT: false- KC_HOSTNAME:- KC_LOG_CONSOLE_FORMAT: "%-5p [%c] (%t) %s%e%n"depends_on:postgresql:condition: service_healthy@@ -51,7 +36,6 @@ services:volumes:- ../tmp:/storage- postgresql-data:/var/lib/postgresql/data- # Access directly if needed on localhostports:- "5432:5432"diff --git a/profile/dev-testing.yml b/profile/dev-testing.ymlindex cbb7b1d9e..ada6c954d 100644--- a/profile/dev-testing.yml+++ b/profile/dev-testing.yml@@ -11,20 +11,11 @@ services:extends:file: deploy.ymlservice: keycloak- # volumes:- # Map custom themes- # - ../deployment:/deploymentports:- "8081:8080"depends_on:postgresql:condition: service_healthy- environment:- KC_HOSTNAME_STRICT_HTTPS: "false"- KC_HOSTNAME_PORT: ${KC_HOSTNAME_PORT:-8080}- KC_LOG_CONSOLE_FORMAT: "%-5p [%c] (%t) %s%e%n"- # Prevent theme caching during dev- KEYCLOAK_START_OPTS: --spi-theme-static-max-age=-1 --spi-theme-cache-themes=false --spi-theme-cache-templates=falsepostgresql:extends:diff --git a/profile/dev-ui.yml b/profile/dev-ui.ymlindex 96227a294..c9c857af6 100644--- a/profile/dev-ui.yml+++ b/profile/dev-ui.yml@@ -13,8 +13,8 @@ services:file: deploy.ymlservice: keycloak#volumes:- # Map custom themes- # - ../deployment:/deployment+ # Map custom themes for theme development+ # - /path/to/theme/src/main/resources/theme/openremote:/opt/keycloak/themes/dev# Access directly if needed on localhostports:- "8081:8080"@@ -22,8 +22,6 @@ services:postgresql:condition: service_healthyenvironment:- KC_HOSTNAME_STRICT_HTTPS: "false"- KC_HOSTNAME_PORT: ${KC_HOSTNAME_PORT:-8080}# Prevent theme caching during devKEYCLOAK_START_OPTS: --spi-theme-static-max-age=-1 --spi-theme-cache-themes=false --spi-theme-cache-templates=falsediff --git a/test/load1/README.md b/test/load1/README.mdindex 79861c0bb..e2c1bf412 100644--- a/test/load1/README.md+++ b/test/load1/README.md@@ -63,7 +63,7 @@ Simulates console devices registering with the Manager and subscribing to attrib#### Test variables-- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `localhost`)+- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `127.0.0.1`)- THREAD_COUNT - Number of threads/users/devices (default: `1000`)- RAMP_RATE - Number of thread/users/devices to add / second (default: `50`)- DURATION - How long each thread should run for in seconds (default: `300`)@@ -101,7 +101,7 @@ _**NOTE: THiS WILL TAKE SOME TIME TO RUN**_#### Test variables-- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `localhost`)+- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `127.0.0.1`)- THREAD_COUNT - Number of threads/users/devices (default: `1000`)- RAMP_RATE - Number of thread/users/devices to add / second (default: `50`)- DURATION - How long each thread should run for in seconds (default: `300`)@@ -132,7 +132,7 @@ provisioned successfully and start publishing attribute events.#### Test variables-- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `localhost`)+- MANAGER_HOSTNAME - The hostname/IP address of the OpenRemote Manager under test (default: `127.0.0.1`)- THREAD_COUNT - Number of threads/users/devices (default: `1000`)- RAMP_RATE - Number of thread/users/devices to add / second (default: `50`)- MILLIS_BETWEEN_PUBLISHES - How long to wait between each time the 2 attributes are published in milliseconds (default: `10000`)diff --git a/test/load1/deployment1/test-load1.yml b/test/load1/deployment1/test-load1.ymlindex 218536793..589ff4d76 100644--- a/test/load1/deployment1/test-load1.yml+++ b/test/load1/deployment1/test-load1.yml@@ -1,6 +1,6 @@# OpenRemote v3#-# Profile that runs the stack by default on https://localhost using a self-signed SSL certificate,+# Profile that runs the stack by default on https://127.0.0.1 using a self-signed SSL certificate,# but optionally on https://$HOST with an auto generated SSL certificate from Letsencrypt.## It is possible to specify OR_SETUP_TYPE=demo to pre-populate the system with a set of demo assets, rules, etc. (as@@ -28,12 +28,12 @@ services:- "80:80"- "443:443"- "8883:8883"- - "127.0.0.1:8404:8404" # Localhost metrics access+ - "127.0.0.1:8404:8404" # Local metrics accessvolumes:- proxy-data:/deploymentenvironment:LE_EMAIL: ${OR_EMAIL_FROM:-}- DOMAINNAME: ${OR_HOSTNAME:-localhost}+ DOMAINNAME: ${OR_HOSTNAME:-127.0.0.1}DOMAINNAMES: ${OR_ADDITIONAL_HOSTNAMES:-}MQTT_RATE_LIMIT: ${MQTT_RATE_LIMIT:-50}# USE A CUSTOM PROXY CONFIG - COPY FROM https://github.com/openremote/proxy/blob/main/haproxy.cfg@@ -56,23 +56,22 @@ services:postgresql:condition: service_healthyenvironment:- KEYCLOAK_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}- KC_HOSTNAME: ${OR_HOSTNAME:-localhost}- KC_HOSTNAME_PORT: ${OR_SSL_PORT:--1}+ KC_BOOTSTRAP_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}+ KC_HOSTNAME: ${OR_HOSTNAME:-127.0.0.1}KC_DB_POOL_MAX_SIZE: ${KC_DB_POOL_MAX_SIZE:-38}manager:restart: alwaysimage: openremote/manager:${MANAGER_VERSION:-latest}healthcheck:- test: ["CMD", "curl", "--fail", "--silent", "http://localhost:8080"]+ test: ["CMD", "curl", "--fail", "--silent", "http://127.0.0.1:8080"]interval: 60sretries: 45depends_on:keycloak:condition: service_healthyports:- - "127.0.0.1:8405:8405" # Localhost metrics access+ - "127.0.0.1:8405:8405" # Local metrics accessenvironment:OR_ADMIN_PASSWORD: ${OR_ADMIN_PASSWORD?OR_ADMIN_PASSWORD must be set}OR_DB_POOL_MAX_SIZE: ${OR_DB_POOL_MAX_SIZE:-60}@@ -85,7 +84,7 @@ services:OR_EMAIL_FROM:OR_EMAIL_ADMIN:OR_SSL_PORT: ${OR_SSL_PORT:--1}- OR_HOSTNAME: ${OR_HOSTNAME:-localhost}+ OR_HOSTNAME: ${OR_HOSTNAME:-127.0.0.1}OR_ADDITIONAL_HOSTNAMES:OR_SETUP_REGULAR_USERS: ${OR_SETUP_REGULAR_USERS:-1000}OR_SETUP_SERVICE_USERS:diff --git a/test/load1/deployment2/console-users.jmx b/test/load1/deployment2/console-users.jmxindex 32ec2d78b..7d0bfec0e 100644--- a/test/load1/deployment2/console-users.jmx+++ b/test/load1/deployment2/console-users.jmx@@ -53,7 +53,7 @@<ConfigTestElement guiclass="HttpDefaultsGui" testclass="ConfigTestElement" testname="Defaults" enabled="true"><intProp name="HTTPSampler.connect_timeout">60000</intProp><intProp name="HTTPSampler.response_timeout">60000</intProp>- <stringProp name="HTTPSampler.domain">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="HTTPSampler.domain">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="HTTPSampler.protocol">https</stringProp><elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" testname="User Defined Variables"><collectionProp name="Arguments.arguments"/>@@ -184,7 +184,7 @@</hashTree><eu.luminis.jmeter.wssampler.OpenWebSocketSampler guiclass="eu.luminis.jmeter.wssampler.OpenWebSocketSamplerGui" testclass="eu.luminis.jmeter.wssampler.OpenWebSocketSampler" testname="WebSocket Open Connection" enabled="true"><boolProp name="TLS">true</boolProp>- <stringProp name="server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="port">443</stringProp><stringProp name="path">/websocket/events?Realm=master&Authorization=Bearer%20${access_token}</stringProp><stringProp name="connectTimeout">20000</stringProp>@@ -194,7 +194,7 @@<eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler guiclass="eu.luminis.jmeter.wssampler.RequestResponseWebSocketSamplerGui" testclass="eu.luminis.jmeter.wssampler.RequestResponseWebSocketSampler" testname="Subscribe attributes" enabled="true"><boolProp name="createNewConnection">false</boolProp><boolProp name="TLS">true</boolProp>- <stringProp name="server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="port">443</stringProp><stringProp name="path">/websocket/events?Realm=master&Authorization=Bearer%20${access_token}</stringProp><stringProp name="connectTimeout">20000</stringProp>diff --git a/test/load1/deployment3/auto-provisioning-settle-test.jmx b/test/load1/deployment3/auto-provisioning-settle-test.jmxindex c755d7f0a..0d8778a30 100644--- a/test/load1/deployment3/auto-provisioning-settle-test.jmx+++ b/test/load1/deployment3/auto-provisioning-settle-test.jmx@@ -68,7 +68,7 @@ props.put("successes", new java.util.concurrent.atomic.AtomicInteger(0</ThreadGroup><hashTree><net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect" enabled="true">- <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="mqtt.port">8883</stringProp><stringProp name="mqtt.version">3.1</stringProp><stringProp name="mqtt.conn_timeout">10</stringProp>diff --git a/test/load1/deployment3/auto-provisioning.jmx b/test/load1/deployment3/auto-provisioning.jmxindex d1d6ab9e7..e27df9e15 100644--- a/test/load1/deployment3/auto-provisioning.jmx+++ b/test/load1/deployment3/auto-provisioning.jmx@@ -43,7 +43,7 @@</CSVDataSet><hashTree/><net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect" enabled="true">- <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="mqtt.port">8883</stringProp><stringProp name="mqtt.version">3.1</stringProp><stringProp name="mqtt.conn_timeout">10</stringProp>diff --git a/test/load2-eks/README.md b/test/load2-eks/README.mdindex 5317f7638..211dd73e8 100644--- a/test/load2-eks/README.md+++ b/test/load2-eks/README.md@@ -73,7 +73,7 @@ If a publish fails because the connection is lost and `RECONNECT_ATTEMPTS` is grAt the end of publish loop, it waits for DISCONNECT_DELAY before disconnecting from MQTT.The parameters are:-MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is localhost.+MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is 127.0.0.1.THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel. Default is 500.ASSETS_COUNT: Number of Light assets for which to publish an attribute during each iteration. Default is 5.RAMP_RATE: Number of thread to add per second during ramp-up. Default is 20.@@ -89,7 +89,7 @@ Once connected, it does 1 single publish every MILLIS_BETWEEN_PUBLISHES (defaultGoal is to measure the time it takes for the system to allow that many connections and stabilise.The parameters are:-MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is localhost.+MANAGER_HOSTNAME: Hostname of the manager to be tested. Default is 127.0.0.1.THREAD_COUNT: Number of parallel accounts that will connect and publish in parallel. Default is 1000.RAMP_RATE: Number of thread to add per second during ramp-up. Default is 50.MILLIS_BETWEEN_PUBLISHES: Delay between each publishing iteration. Default is 30000.diff --git a/test/load2-eks/profiles/2xlarge/values-manager-eks-load.yaml b/test/load2-eks/profiles/2xlarge/values-manager-eks-load.yamlindex 8a59a0773..f754b9b11 100644--- a/test/load2-eks/profiles/2xlarge/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/2xlarge/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/profiles/4xlarge/values-manager-eks-load.yaml b/test/load2-eks/profiles/4xlarge/values-manager-eks-load.yamlindex c754d353a..1a257ee75 100644--- a/test/load2-eks/profiles/4xlarge/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/4xlarge/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/profiles/8xlarge/values-manager-eks-load.yaml b/test/load2-eks/profiles/8xlarge/values-manager-eks-load.yamlindex 427e5557f..6abd04a45 100644--- a/test/load2-eks/profiles/8xlarge/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/8xlarge/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/profiles/large/values-manager-eks-load.yaml b/test/load2-eks/profiles/large/values-manager-eks-load.yamlindex cc315bf1d..26232bb31 100644--- a/test/load2-eks/profiles/large/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/large/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/profiles/xlarge-minimal/values-manager-eks-load.yaml b/test/load2-eks/profiles/xlarge-minimal/values-manager-eks-load.yamlindex 6cf3aa181..f09aecd72 100644--- a/test/load2-eks/profiles/xlarge-minimal/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/xlarge-minimal/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/profiles/xlarge/values-manager-eks-load.yaml b/test/load2-eks/profiles/xlarge/values-manager-eks-load.yamlindex 630e99f72..cde96d4e0 100644--- a/test/load2-eks/profiles/xlarge/values-manager-eks-load.yaml+++ b/test/load2-eks/profiles/xlarge/values-manager-eks-load.yaml@@ -54,4 +54,4 @@ or:- name: JAVA_OPTS_APPENDvalue: "-Dhibernate.generate_statistics=true -Xlog:gc*,gc+ref=debug,gc+phases=debug,gc+age=debug,safepoint:file=gc.log"- name: JAVA_TOOL_OPTIONS- value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=localhost"+ value: "-Dcom.sun.management.jmxremote=true -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8085 -Dcom.sun.management.jmxremote.rmi.port=8085 -Djava.rmi.server.hostname=127.0.0.1"diff --git a/test/load2-eks/scenarios/connect-and-publish.jmx b/test/load2-eks/scenarios/connect-and-publish.jmxindex 52a2fe5a1..ee962938d 100644--- a/test/load2-eks/scenarios/connect-and-publish.jmx+++ b/test/load2-eks/scenarios/connect-and-publish.jmx@@ -41,7 +41,7 @@ props.put("THREAD_COUNT", threadCount)log.info(">>>Thread count ${threadCount}")-def host = props.get("MANAGER_HOSTNAME") ?: "localhost"+def host = props.get("MANAGER_HOSTNAME") ?: "127.0.0.1"log.info(">>>Host ${host}")// Store global var for tracking device init successes - decrement this on each device start and increment on publish success@@ -104,7 +104,7 @@ if (vars.getObject("threadEndTime") == null) {</JSR223Sampler><hashTree/><net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect" enabled="true">- <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="mqtt.port">8883</stringProp><stringProp name="mqtt.version">3.1</stringProp><stringProp name="mqtt.conn_timeout">10</stringProp>diff --git a/test/load2-eks/scenarios/connect-settle-test.jmx b/test/load2-eks/scenarios/connect-settle-test.jmxindex 1e790c5eb..5dd4cdb46 100644--- a/test/load2-eks/scenarios/connect-settle-test.jmx+++ b/test/load2-eks/scenarios/connect-settle-test.jmx@@ -74,7 +74,7 @@ vars.put("assetId", assetId)</JSR223Sampler><hashTree/><net.xmeter.samplers.ConnectSampler guiclass="net.xmeter.gui.ConnectSamplerUI" testclass="net.xmeter.samplers.ConnectSampler" testname="connect">- <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,localhost)}</stringProp>+ <stringProp name="mqtt.server">${__P(MANAGER_HOSTNAME,127.0.0.1)}</stringProp><stringProp name="mqtt.port">8883</stringProp><stringProp name="mqtt.version">3.1</stringProp><stringProp name="mqtt.conn_timeout">10</stringProp>diff --git a/test/src/test/groovy/org/openremote/test/alarm/AlarmResourceTest.groovy b/test/src/test/groovy/org/openremote/test/alarm/AlarmResourceTest.groovyindex 85a505e9e..51468bdaf 100644--- a/test/src/test/groovy/org/openremote/test/alarm/AlarmResourceTest.groovy+++ b/test/src/test/groovy/org/openremote/test/alarm/AlarmResourceTest.groovy@@ -100,7 +100,7 @@ class AlarmResourceTest extends Specification implements ManagerContainerTrait {regularUserResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM).proxy(AlarmResource.class)adminResource = getClientApiTarget(serverUri(serverPort), MASTER_REALM, adminAccessToken).proxy(AlarmResource.class)- User alarmsReadWriteUser = keycloakTestSetup.createUser(MASTER_REALM, "alarmsrwuser1", "alarmsrwuser1", "Alarms R/W", "User", "[email protected]", true, KeycloakTestSetup.REGULAR_USER_ROLES)+ User alarmsReadWriteUser = keycloakTestSetup.createUser(MASTER_REALM, "alarmsrwuser1", "alarmsrwuser1", "Alarms RW", "User", "[email protected]", true, KeycloakTestSetup.REGULAR_USER_ROLES)alarmsReadWriteUserId = alarmsReadWriteUser.getId()User superUser = keycloakTestSetup.createUser(MASTER_REALM, "testuser4", "testuser4", "Demo4", "Demo4", null, true, new ClientRole[] {diff --git a/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy b/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovyindex 0745db935..8314b7b63 100644--- a/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy+++ b/test/src/test/groovy/org/openremote/test/assets/AssetDatapointTest.groovy@@ -106,7 +106,7 @@ class AssetDatapointTest extends Specification implements ManagerContainerTraitnew URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=$websocketRealm").build(),null,new OAuthPasswordGrant(- "http://127.0.0.1:$serverPort/auth/realms/$authRealm/protocol/openid-connect/token",+ "http://127.0.0.1:8081/auth/realms/$authRealm/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,@@ -595,7 +595,7 @@ class AssetDatapointTest extends Specification implements ManagerContainerTraitnew URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=master").build(),null,new OAuthPasswordGrant(- "http://127.0.0.1:$serverPort/auth/realms/master/protocol/openid-connect/token",+ "http://127.0.0.1:8081/auth/realms/master/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,diff --git a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovyindex 5ad6b3794..3d27085a2 100644--- a/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy+++ b/test/src/test/groovy/org/openremote/test/gateway/GatewayTest.groovy@@ -51,6 +51,8 @@ import org.openremote.model.auth.OAuthClientCredentialsGrantimport org.openremote.model.event.shared.SharedEventimport org.openremote.model.gateway.*import org.openremote.model.geo.GeoJSONPoint+import org.openremote.model.notification.AbstractNotificationMessage+import org.openremote.model.notification.Notificationimport org.openremote.model.query.AssetQueryimport org.openremote.model.query.filter.RealmPredicateimport org.openremote.model.security.User@@ -61,6 +63,7 @@ import org.openremote.model.value.ValueFormatimport org.openremote.setup.integration.ManagerTestSetupimport org.openremote.test.ManagerContainerTraitimport spock.lang.Ignore+import spock.lang.Sharedimport spock.lang.Specificationimport spock.util.concurrent.PollingConditions@@ -87,11 +90,30 @@ import static org.openremote.model.value.ValueType.*// TODO: Add tests for each supported version of the gateway APIclass GatewayTest extends Specification implements ManagerContainerTrait {+ def setupSpec() {+ // Mock the GatewayClientService so we can use a different port for authentication on the GatewayClientConnector+ def services = defaultServices().toList()+ def gatewayClientServiceIndex = services.findIndexOf {it instanceof GatewayClientService}+ def gatewayClientService = services.removeAt(gatewayClientServiceIndex) as GatewayClientService+ def spyGatewayClientService = Spy(gatewayClientService)+ services.add(gatewayClientServiceIndex, spyGatewayClientService) // Must go back in the correct position as already sorted by priority++ spyGatewayClientService.createClientConnector(_ as GatewayConnection) >> { GatewayConnection connection ->+ def identityProvider = container.getService(ManagerIdentityService.class).identityProvider as ManagerKeycloakIdentityProvider+ def keycloakURL = identityProvider.getKeycloakPublicUrl()+ // Use keycloaks public URI as it's on a different port to the manager under test+ connection.@tokenEndpointURI = new URIBuilder(keycloakURL).setPath("auth/realms/" + connection.getRealm() + "/protocol/openid-connect/token").build().toString()+ callRealMethod()+ }++ // Start the container with the spy service+ startContainer(defaultConfig(), services)+ }+def "Gateway asset provisioning and local manager logic test"() {given: "the container environment is started"def conditions = new PollingConditions(timeout: 15, delay: 0.2)- def container = startContainer(defaultConfig(), defaultServices())def assetProcessingService = container.getService(AssetProcessingService.class)def timerService = container.getService(TimerService.class)def assetStorageService = container.getService(AssetStorageService.class)@@ -151,7 +173,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {def gatewayClient = new WebsocketIOClient(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=$managerTestSetup.realmBuildingName").build(),null,- new OAuthClientCredentialsGrant("http://127.0.0.1:$serverPort/auth/realms/$managerTestSetup.realmBuildingName/protocol/openid-connect/token",+ new OAuthClientCredentialsGrant("http://127.0.0.1:8081/auth/realms/$managerTestSetup.realmBuildingName/protocol/openid-connect/token",gateway.getClientId().orElse(""),gateway.getClientSecret().orElse(""),null).setBasicAuthHeader(true))@@ -484,10 +506,9 @@ class GatewayTest extends Specification implements ManagerContainerTrait {and: "the central manager should have responded to indicate sync is done"conditions.eventually {- def initDoneEventStr = clientReceivedMessages.find {- it.contains(GatewayInitDoneEvent.TYPE)- }+ def initDoneEventStr = clientReceivedMessages.find {it.contains(GatewayInitDoneEvent.TYPE)}def gatewayInitDoneEvent = ValueUtil.JSON.readValue(initDoneEventStr.substring(SharedEvent.MESSAGE_PREFIX.length()), GatewayInitDoneEvent.class)+ assert gatewayInitDoneEvent != null}and: "the gateway client should now be CONNECTED"@@ -720,7 +741,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {gatewayClient = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=$managerTestSetup.realmBuildingName").build(),null,- new OAuthClientCredentialsGrant("http://127.0.0.1:$serverPort/auth/realms/$managerTestSetup.realmBuildingName/protocol/openid-connect/token",+ new OAuthClientCredentialsGrant("http://127.0.0.1:8081/auth/realms/$managerTestSetup.realmBuildingName/protocol/openid-connect/token",gateway.getClientId().orElse(""),gateway.getClientSecret().orElse(""),null).setBasicAuthHeader(true))@@ -896,16 +917,18 @@ class GatewayTest extends Specification implements ManagerContainerTrait {when: "the gateway asset is deleted"def deleted = assetStorageService.delete([gateway.id])+ def gatewayId = gateway.id+ gateway = nullthen: "all descendant assets should have been removed"conditions.eventually {- assert assetStorageService.find(mapAssetId(gateway.id, assets[0].id, true)) == null+ assert assetStorageService.find(mapAssetId(gatewayId, assets[0].id, true)) == null}then: "the keycloak client should also be removed"assert deletedconditions.eventually {- assert identityProvider.getClient(managerTestSetup.realmBuildingName, getGatewayClientId(gateway.getId())) == null+ assert identityProvider.getClient(managerTestSetup.realmBuildingName, getGatewayClientId(gatewayId)) == null}cleanup: "cleanup the gateway client"@@ -913,6 +936,9 @@ class GatewayTest extends Specification implements ManagerContainerTrait {gatewayClient.disconnect()gatewayClient.removeAllMessageConsumers()}+ if (gateway != null) {+ assetStorageService.delete([gateway.id])+ }}def "Verify gateway client service"() {@@ -920,15 +946,13 @@ class GatewayTest extends Specification implements ManagerContainerTrait {given: "the container environment is started"def conditions = new PollingConditions(timeout: 30, delay: 0.2)def delayedConditions = new PollingConditions(initialDelay: 1, delay: 1, timeout: 10)- def container = startContainer(defaultConfig(), defaultServices())- def timerService = container.getService(TimerService.class)def assetProcessingService = container.getService(AssetProcessingService.class)def assetStorageService = container.getService(AssetStorageService.class)def gatewayService = container.getService(GatewayService.class)def gatewayClientService = container.getService(GatewayClientService.class)- def agentService = container.getService(AgentService.class)def managerTestSetup = container.getService(SetupService.class).getTaskOfType(ManagerTestSetup.class)def clientEventService = container.getService(ClientEventService.class)+ def originalMicrophone1 = assetStorageService.find(managerTestSetup.microphone1Id)and: "an authenticated admin user"def accessToken = authenticate(@@ -1288,12 +1312,21 @@ class GatewayTest extends Specification implements ManagerContainerTrait {}cleanup: "Remove any subscriptions created"+ if (gatewayClientResource != null) {+ gatewayClientResource.deleteConnection(null, managerTestSetup.realmCityName)+ }if (clientEventService != null) {clientEventService.removeSubscription(eventConsumer)}if (gateway != null) {assetStorageService.delete([gateway.id])}+ if (microphone2 != null) {+ assetStorageService.delete([microphone2.id])+ }+ if (originalMicrophone1 != null) {+ assetStorageService.merge(originalMicrophone1)+ }}/**@@ -1375,16 +1408,11 @@ class GatewayTest extends Specification implements ManagerContainerTrait {given: "the container environment is started"def conditions = new PollingConditions(timeout: 30, delay: 0.2)- def delayedConditions = new PollingConditions(initialDelay: 1, delay: 1, timeout: 10)- def container = startContainer(defaultConfig(), defaultServices())- def timerService = container.getService(TimerService.class)def assetProcessingService = container.getService(AssetProcessingService.class)def assetStorageService = container.getService(AssetStorageService.class)def gatewayService = container.getService(GatewayService.class)def gatewayClientService = container.getService(GatewayClientService.class)- def agentService = container.getService(AgentService.class)def managerTestSetup = container.getService(SetupService.class).getTaskOfType(ManagerTestSetup.class)- def clientEventService = container.getService(ClientEventService.class)and: "an authenticated admin user"def accessToken = authenticate(@@ -1440,16 +1468,14 @@ class GatewayTest extends Specification implements ManagerContainerTrait {]).setAddAttributeMeta(["*": new MetaMap([new MetaItem<>(ACCESS_RESTRICTED_READ, true)])]).setExcludeAttributes([Asset.NOTES.name]),- "LightAsset" : new GatewayAssetSyncRule().setExcludeAttributeMeta([+ "LightAsset": new GatewayAssetSyncRule().setExcludeAttributeMeta(["*": [ATTRIBUTE_LINKS.name,ACCESS_PUBLIC_WRITE.name,FORMAT.name]]).setAddAttributeMeta([- "onOff" : new MetaMap([- new MetaItem<>(FORMAT, ValueFormat.BOOLEAN_AS_PRESSED_RELEASED())- ])+ "onOff": new MetaMap([new MetaItem<>(FORMAT, ValueFormat.BOOLEAN_AS_PRESSED_RELEASED())])]).setExcludeAttributes([LightAsset.COLOUR_RGB.name]).setAccessPublicRead(false)] as Map<String, GatewayAssetSyncRule>,false@@ -1512,9 +1538,89 @@ class GatewayTest extends Specification implements ManagerContainerTrait {assert mirroredLight.getAttribute(Asset.NOTES).isPresent()assert !mirroredLight.isAccessPublicRead()}++ cleanup: "the gateway connection is removed"+ if (gatewayClientResource != null) {+ gatewayClientResource.deleteConnection(null, managerTestSetup.realmCityName)+ }}+ /**+ * This test requires a manager instance with tunnelling configured, so is manual for now unfortunately.+ * Change the test url and key path to match the instance to connect to.+ * Recommended to run profile/dev-proxy.yml profile.+ */+ @Ignore+ def "Verify gateway tunnel factory"() {+ given: "an ssh private key and the URL of a manager instance with tunnelling configured"+ def keyPath = Paths.get(System.getProperty("user.home"), ".ssh", "test_key")+ def tunnelSSHHost = "custom-project-test.openremote.app"+ def tunnelSSHPort = 2222+ def tmpDir = new File("tmp")+ def lockFile = new File(tmpDir, "lock.file")++ and: "an instance of the gateway tunnel factory is created"+ def container = new Container(Collections.emptyMap(), Collections.emptyList())+ def conditions = new PollingConditions(timeout: 15, delay: 1)+ def tunnelFactory = new MINAGatewayTunnelFactory(container.EXECUTOR, Container.SCHEDULED_EXECUTOR, keyPath.toFile(), null)+ tunnelFactory.start()++ expect: "the SSH client to be ready"+ conditions.eventually {+ tunnelFactory.client.isStarted()+ }++ and: "A configured GatewayTunnelInfo for HTTPS on 127.0.0.1:443"+ def tunnelInfo = new GatewayTunnelInfo(Constants.MASTER_REALM,+ "abcedf123456",+ GatewayTunnelInfo.Type.HTTPS,+ "127.0.0.1", 443)++ and: "A completion variable for the close callback"+ AtomicBoolean closed = new AtomicBoolean(false)++ when: "Create session is called"+ GatewayTunnelSession session = tunnelFactory.createSession(tunnelSSHHost, tunnelSSHPort, tunnelInfo, { t ->+ closed.set(true)+ })++ then: "The session connection future should complete successfully"+ new PollingConditions(timeout: 60).eventually {+ assert session.getConnectFuture().isDone()+ assert !session.getConnectFuture().isCompletedExceptionally()+ }++ then: "we keep the tunnel open for manual testing until lock file is deleted"+ if (!tmpDir.exists()) {+ tmpDir.mkdirs()+ }+ if (!lockFile.exists()) {+ lockFile.createNewFile()+ }+ getLOG().info("---------------------------------------------------------------------------------")+ getLOG().info("TEST PAUSED FOR TUNNEL TESTING")+ getLOG().info("Delete the lock file to continue: ${lockFile.absolutePath}")+ getLOG().info("Tunnel should be accessible at: gw-54tnxwr2oobjafque1jndh.${tunnelSSHHost}")+ getLOG().info("---------------------------------------------------------------------------------")++ while (lockFile.exists()) {+ getLOG().info("Tunnel is open")+ Thread.sleep(5000)+ }++ when: "we close the tunnel gracefully"+ session.disconnect()++ then: "the tunnel should be closed without error"+ noExceptionThrown()++ cleanup: "cleanup"+ if (tunnelFactory != null) {+ tunnelFactory.stop()+ }+ }+/*** This test requires a manager instance with tunnelling configured, so is manual for now unfortunately.* Refer to "Gateway Tunnelling Setup" in the docs for setting up the required environment.@@ -1525,10 +1631,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {@Ignoredef "Gateway Tunneling Edge Gateway Integration test"() {given: "the container environment is started"-def sshKeyPath = Paths.get("deployment/sish/client/client")--def conditions = new PollingConditions(timeout: 6000, delay: 0.2)// The port where this test's manager webserver will run. cannot use random ephemeral port because of// its randomization, which when generating the gateway tunnel ID, will then generate a different gateway ID each time.@@ -1540,7 +1643,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {and: "Central Instance information with tunnelling enabled"- def centralInstanceHostname = "localhost"+ def centralInstanceHostname = "127.0.0.1"def centralInstancePort = 443def isCentralInstanceSecure = (centralInstancePort == 443)def centralInstanceRealm = managerTestSetup.realmMasterName@@ -1557,6 +1660,8 @@ class GatewayTest extends Specification implements ManagerContainerTrait {MASTER_REALM_ADMIN_USER,getString(container.getConfig(), OR_ADMIN_PASSWORD, OR_ADMIN_PASSWORD_DEFAULT))++ and: "the gateway client resource"def gatewayResource = getClientApiTarget(serverUri((isCentralInstanceSecure), centralInstanceHostname, centralInstancePort), MASTER_REALM, accessToken).proxy(GatewayServiceResource.class)when: "a new gateway client connection is created to connect to the central instance"@@ -1597,7 +1702,7 @@ class GatewayTest extends Specification implements ManagerContainerTrait {centralInstanceRealm,gatewayAssetId,GatewayTunnelInfo.Type.HTTP,- "localhost",+ "127.0.0.1",webserverPort)def centralManagerTunnelInfo = gatewayResource.startTunnel(tunnelInfo)@@ -1616,8 +1721,8 @@ class GatewayTest extends Specification implements ManagerContainerTrait {We can now request `/auth` from the tunnel URL, and the request route would look like this:This Groovy test --> Central Instance --> Sish --> Gateway Proxy --> Keycloak/ManagerFor the "Sish --> Gateway Proxy" request to be routed correctly, we need to edit our local `/etc/hosts` file- to route the <tunnelid>.<tunnelSSHHost> to localhost, like this:- 127.0.0.1 gw-5fj1sxvwwfp7wvgqgve91n.localhost+ to route the <tunnelid>.<tunnelSSHHost> to 127.0.0.2, like this:+ 127.0.0.1 gw-5fj1sxvwwfp7wvgqgve91n.127.0.0.1If that is setup, the request correctly routes through the tunnel to the gateway, and we can request the edge manager.To assert proper connectivity, we are going to request a new admin token from the tunnel URL to make sure theKeycloak connection works, but also request the server info, which proves that the request has reached the manager@@ -1668,5 +1773,10 @@ class GatewayTest extends Specification implements ManagerContainerTrait {conditions.eventually {assert gatewayClientService.tunnelAutoCloseTasks.mappingCount() == 0}++ cleanup: "the gateway connection is removed"+ if (gatewayResource != null) {+ gatewayResource.deleteConnection(null, managerTestSetup.realmCityName)+ }}}diff --git a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovyindex 9f52bedc0..605ab9f69 100644--- a/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy+++ b/test/src/test/groovy/org/openremote/test/notification/NotificationTest.groovy@@ -1042,9 +1042,12 @@ class NotificationTest extends Specification implements ManagerContainerTrait {pushNotificationTargetIds.clear()pushNotificationMessages.clear()- and: "testuser1 sets their language back to dutch"+ when: "testuser1 sets their language back to dutch"testuser1.setAttribute(User.LOCALE_ATTRIBUTE, "nl")- identityService.getIdentityProvider().createUpdateUser(MASTER_REALM, testuser1, null, true)+ testuser1 = identityService.getIdentityProvider().createUpdateUser(MASTER_REALM, testuser1, null, true)++ then: "we should see the new value in the user attributes"+ testuser1.getAttributeMap().get(User.LOCALE_ATTRIBUTE).getFirst() == "nl"/* ----------- */@@ -1087,7 +1090,7 @@ class NotificationTest extends Specification implements ManagerContainerTrait {and: "the complex notification is sent"adminNotificationResource.sendNotification(null, complexNotification)- then: "it should return a BAD_REQUEST because testuser1 only gets one notification"+ then: "it should return a BAD_REQUEST because the admin user doesn't get the email notification and the test user doesn't get the push notification"thrown(BadRequestException)and: "the other notifications should be sent correctly through email and with push"@@ -1131,14 +1134,6 @@ class NotificationTest extends Specification implements ManagerContainerTrait {then: "it should return a BAD_REQUEST, because the message is invalid"thrown(BadRequestException)- and: "all users should receive the english message"- conditions.eventually {- assert localizedNotificationMessages.size() == 0- assert localizedNotificationTargetIds.size() == 0- assert pushNotificationMessages.size() == 0- }--/* ------------------------ *//*when: "if the notification became valid, and the TRIGGER_ASSETS placeholder is inserted"diff --git a/test/src/test/groovy/org/openremote/test/protocol/io/NettyIOClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/io/NettyIOClientTest.groovyindex 239f6173e..405982b63 100644--- a/test/src/test/groovy/org/openremote/test/protocol/io/NettyIOClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/io/NettyIOClientTest.groovy@@ -47,7 +47,7 @@ class NettyIOClientTest extends Specification implements ManagerContainerTrait {def client = new WebsocketIOClient(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=random").build(),null,- new OAuthClientCredentialsGrant("http://127.0.0.1:$serverPort/auth/realms/random/protocol/openid-connect/token",+ new OAuthClientCredentialsGrant("http://127.0.0.1:8081/auth/realms/random/protocol/openid-connect/token",'abcd','abcd',null).setBasicAuthHeader(true)diff --git a/test/src/test/groovy/org/openremote/test/protocol/lorawan/chirpstack/ChirpStackTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/lorawan/chirpstack/ChirpStackTest.groovyindex 32658c6de..ca4930c34 100644--- a/test/src/test/groovy/org/openremote/test/protocol/lorawan/chirpstack/ChirpStackTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/lorawan/chirpstack/ChirpStackTest.groovy@@ -82,7 +82,7 @@ class ChirpStackTest extends Specification implements ManagerContainerTrait {static final String VENDOR_ID = "dragino"static final String MODEL_ID = "lht65"static final String FIRMWARE_VERSION = "1.8"- static final String HOST = "localhost"+ static final String HOST = "127.0.0.1"static final Integer UPLINK_PORT = 2static final Integer DOWNLINK_PORT = 4static final Double TEMPERATURE_VALUE = 20.4diff --git a/test/src/test/groovy/org/openremote/test/protocol/lorawan/tts/TheThingsStackTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/lorawan/tts/TheThingsStackTest.groovyindex 21f93f3f9..4826554ae 100644--- a/test/src/test/groovy/org/openremote/test/protocol/lorawan/tts/TheThingsStackTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/lorawan/tts/TheThingsStackTest.groovy@@ -89,7 +89,7 @@ class TheThingsStackTest extends Specification implements ManagerContainerTraitstatic final String VENDOR_ID = "dragino"static final String MODEL_ID = "lht65"static final String FIRMWARE_VERSION = "1.8"- static final String HOST = "localhost"+ static final String HOST = "127.0.0.1"static final Integer UPLINK_PORT = 2static final Integer DOWNLINK_PORT = 4static final Double TEMPERATURE_VALUE = 20.4diff --git a/test/src/test/groovy/org/openremote/test/protocol/mail/MailClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/mail/MailClientTest.groovyindex 27ff6944d..493cf9528 100644--- a/test/src/test/groovy/org/openremote/test/protocol/mail/MailClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/mail/MailClientTest.groovy@@ -104,7 +104,7 @@ class MailClientTest extends Specification implements ManagerContainerTrait {executor,scheduledExecutor,"pop3",- "localhost",+ "127.0.0.1",greenMail.getPop3().getServerSetup().getPort()).setBasicAuth("or", "secret").setCheckIntervalSeconds(2)@@ -186,7 +186,7 @@ class MailClientTest extends Specification implements ManagerContainerTrait {executor,scheduledExecutor,"pop3",- "localhost",+ "127.0.0.1",greenMail.getPop3().getServerSetup().getPort()).setBasicAuth("or", "secret").setCheckIntervalSeconds(2)@@ -247,7 +247,7 @@ class MailClientTest extends Specification implements ManagerContainerTrait {executor,scheduledExecutor,"imap",- "localhost",+ "127.0.0.1",greenMail.getImap().getServerSetup().getPort()).setBasicAuth("or", "secret").setCheckIntervalSeconds(2)diff --git a/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovyindex fd224911a..80a66518e 100644--- a/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/mqtt/MQTTClientProtocolTest.groovy@@ -105,7 +105,7 @@ class MQTTClientProtocolTest extends Specification implements ManagerContainerTrList<String> failedSubs = new CopyOnWriteArrayList()List<MQTTMessage<String>> received = new CopyOnWriteArrayList<>()def clientId = "ortest1"- def host = "localhost"+ def host = "127.0.0.1"def port = 1883def secure = falsedef counter = 0diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovyindex a874a1ec6..9e92b0d68 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientProtocolTest.groovy@@ -145,7 +145,7 @@ class WebsocketClientProtocolTest extends Specification implements ManagerContaidef agent = new WebsocketAgent("Test agent").setRealm(Constants.MASTER_REALM).setConnectURI("ws://127.0.0.1:$serverPort/websocket/events?Realm=master")- .setOAuthGrant(new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/master/protocol/openid-connect/token",+ .setOAuthGrant(new OAuthPasswordGrant("http://127.0.0.1:8081/auth/realms/master/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,diff --git a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovyindex f262fcd68..23c0b382b 100644--- a/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy+++ b/test/src/test/groovy/org/openremote/test/protocol/websocket/WebsocketClientTest.groovy@@ -101,7 +101,7 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitdef client = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=building").build(),null,- new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/building/protocol/openid-connect/token",+ new OAuthPasswordGrant("http://127.0.0.1:8081/auth/realms/building/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,@@ -119,7 +119,7 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitdef client2 = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=building").build(),null,- new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/building/protocol/openid-connect/token",+ new OAuthPasswordGrant("http://127.0.0.1:8081/auth/realms/building/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,@@ -450,7 +450,7 @@ class WebsocketClientTest extends Specification implements ManagerContainerTraitdef client = new WebsocketIOClient<String>(new URIBuilder("ws://127.0.0.1:$serverPort/websocket/events?Realm=master").build(),null,- new OAuthPasswordGrant("http://127.0.0.1:$serverPort/auth/realms/master/protocol/openid-connect/token",+ new OAuthPasswordGrant("http://127.0.0.1:8081/auth/realms/master/protocol/openid-connect/token",KEYCLOAK_CLIENT_ID,null,null,diff --git a/test/src/test/groovy/org/openremote/test/rules/AlarmRuleTest.groovy b/test/src/test/groovy/org/openremote/test/rules/AlarmRuleTest.groovyindex 8f861db53..c853b923f 100644--- a/test/src/test/groovy/org/openremote/test/rules/AlarmRuleTest.groovy+++ b/test/src/test/groovy/org/openremote/test/rules/AlarmRuleTest.groovy@@ -83,7 +83,7 @@ class AlarmRuleTest extends Specification implements ManagerContainerTrait {keycloakTestSetup = container.getService(SetupService.class).getTaskOfType(KeycloakTestSetup.class)managerTestSetup = container.getService(SetupService.class).getTaskOfType(ManagerTestSetup.class)- User alarmsReadWriteUser = keycloakTestSetup.createUser(managerTestSetup.realmBuildingName, "alarmsrwuser1", "alarmsrwuser1", "Alarms R/W", "User", "[email protected]", true, KeycloakTestSetup.REGULAR_USER_ROLES)+ User alarmsReadWriteUser = keycloakTestSetup.createUser(managerTestSetup.realmBuildingName, "alarmsrwuser1", "alarmsrwuser1", "Alarms RW", "User", "[email protected]", true, KeycloakTestSetup.REGULAR_USER_ROLES)alarmsReadWriteUserId = alarmsReadWriteUser.getId()alarmService = container.getService(AlarmService.class)diff --git a/test/src/test/java/org/openremote/test/protocol/MockSerialChannel.java b/test/src/test/java/org/openremote/test/protocol/MockSerialChannel.javaindex 47f24f6e4..bc201a2d8 100644--- a/test/src/test/java/org/openremote/test/protocol/MockSerialChannel.java+++ b/test/src/test/java/org/openremote/test/protocol/MockSerialChannel.java@@ -43,7 +43,7 @@ import org.openremote.agent.protocol.serial.JSerialCommDeviceAddress;public class MockSerialChannel extends OioByteStreamChannel {private static final JSerialCommDeviceAddress LOCAL_ADDRESS =- new JSerialCommDeviceAddress("localhost");+ new JSerialCommDeviceAddress("127.0.0.1");public interface DataHandler {void onDataWritten(byte[] data, ResponseCallback responseCallback);diff --git a/ui/app/manager/src/pages/page-gateway-tunnel.ts b/ui/app/manager/src/pages/page-gateway-tunnel.tsindex 569008d9e..661e07b11 100644--- a/ui/app/manager/src/pages/page-gateway-tunnel.ts+++ b/ui/app/manager/src/pages/page-gateway-tunnel.ts@@ -556,7 +556,7 @@ export class PageGatewayTunnel extends Page<AppStateKeyed> {*/protected _getDefaultTunnelToAdd(): GatewayTunnelInfo {return {- target: "localhost",+ target: "127.0.0.1",targetPort: 443,type: this.GATEWAY_TUNNEL_PROTOCOL_TYPES?.[0],};diff --git a/ui/app/manager/src/pages/page-users.ts b/ui/app/manager/src/pages/page-users.tsindex 109d43fe7..59eaefbee 100644--- a/ui/app/manager/src/pages/page-users.ts+++ b/ui/app/manager/src/pages/page-users.ts@@ -628,7 +628,7 @@ export class PageUsers extends Page<AppStateKeyed> {<p class="panel-title">${user.serviceAccount ? i18next.t("serviceUser") : i18next.t("user")} ${i18next.t("settings")}</p>- ${this.getSingleUserView(user, compositeRoleOptions, realmRoleOptions, "user" + index, readonly || this._saveUserPromise != undefined)}+ ${this.getSingleUserView(user, compositeRoleOptions, realmRoleOptions, index != undefined ? "user" + index : "", readonly || this._saveUserPromise != undefined)}</div>${when(showMqttSessions, () => this.getMQTTSessionTemplate(user))}@@ -883,11 +883,11 @@ export class PageUsers extends Page<AppStateKeyed> {protected onUserChanged(suffix: string) {// Don't have form-associated custom element support in lit at time of writing which would be the way to go here- const validateArray = this.shadowRoot.querySelectorAll(".validate");+ const validateArray = Array.from(this.shadowRoot.querySelectorAll(".validate"))+ .map((element) => element.querySelector("input"))+ .filter((input) => input !== null);const saveBtn = this.shadowRoot.getElementById("savebtn-" + suffix) as OrVaadinButton;- const saveDisabled = Array.from(validateArray)- .filter((e) => e instanceof HTMLInputElement)- .some((input) => !(input as HTMLInputElement).checkValidity());+ const saveDisabled = Array.from(validateArray).some((input) => !(input as HTMLInputElement).checkValidity());saveBtn.disabled = saveDisabled;}@@ -1051,9 +1051,9 @@ export class PageUsers extends Page<AppStateKeyed> {class="validate" minlength="3" maxlength="255"?readonly=${!!user.id || readonly || (!isServiceUser && this._registrationEmailAsUsername)}?required=${isServiceUser || !this._registrationEmailAsUsername}- pattern="[A-Za-z0-9_+@\\.\\-ßçʊÇʊ]+"+ pattern="[^<>&"'\\s\\v$%!#?§,;:*~\\/\\\\\\|^=\\[\\]\\{\\}\\(\\)\`\\p{Control}]+"value=${user.username} autocomplete="false"- error-message=${i18next.t("invalidUsername")}+ error-message=${i18next.t("invalidCharacters")}@change=${(ev: Event) => {user.username = (ev.currentTarget as HTMLInputElement).value;this.onUserChanged(suffix);@@ -1078,6 +1078,8 @@ export class PageUsers extends Page<AppStateKeyed> {</or-vaadin-email-field><or-vaadin-text-field id="new-firstName" class="${isServiceUser ? "hidden" : "validate"}"?readonly="${readonly}" minlength="1" maxlength="255"+ pattern='[^<>&"\\v$%!#?§;*~\\/\\\\\\|^=\\[\\]\\{\\}\\(\\)\\p{Control}]+'+ error-message=${i18next.t("invalidCharacters")}value=${user.firstName} autocomplete="false"@change=${(ev: Event) => {user.firstName = (ev.currentTarget as HTMLInputElement).value;@@ -1087,6 +1089,8 @@ export class PageUsers extends Page<AppStateKeyed> {</or-vaadin-text-field><or-vaadin-text-field id="new-surname" class="${isServiceUser ? "hidden" : "validate"}"?readonly="${readonly}" minlength="1" maxlength="255"+ pattern='[^<>&"\\v$%!#?§;*~\\/\\\\\\|^=\\[\\]\\{\\}\\(\\)\\p{Control}]+'+ error-message=${i18next.t("invalidCharacters")}value=${user.lastName} autocomplete="false"@change=${(ev: Event) => {user.lastName = (ev.currentTarget as HTMLInputElement).value;diff --git a/ui/app/manager/test/fixtures/manager.ts b/ui/app/manager/test/fixtures/manager.tsindex 893a65cf9..6d435e566 100644--- a/ui/app/manager/test/fixtures/manager.ts+++ b/ui/app/manager/test/fixtures/manager.ts@@ -82,7 +82,7 @@ export class Manager {readonly baseURL: string,request?: APIRequestContext) {- this.managerHost = process.env.managerUrl || "http://localhost:8080";+ this.managerHost = process.env.managerUrl || "http://127.0.0.1:8080";rest.initialise(`${this.managerHost}/api/master/`);this.api = rest.api;this.axios = rest.axiosInstance;diff --git a/ui/app/shared/locales/en/or.json b/ui/app/shared/locales/en/or.jsonindex 09785ae28..c869cc36a 100644--- a/ui/app/shared/locales/en/or.json+++ b/ui/app/shared/locales/en/or.json@@ -809,10 +809,10 @@"savePasswordFailed": "Failed to set the password.","userAlreadyExists": "Error occurred! This user already exists.","realmAlreadyExists": "Realm name already exists",- "invalidUsername": "Username must be 3-255 alpha numerical characters","invalidEmail": "Invalid email address","invalidUrl": "Enter a valid URL, e.g. https://example.com","invalidRealm": "Realm must be 2-255 alpha numerical characters",+ "invalidCharacters": "Length invalid or invalid characters found","yes": "Yes","no": "No","tag": "Tag",diff --git a/ui/app/shared/locales/nl/or.json b/ui/app/shared/locales/nl/or.jsonindex 7178987ac..904e309ff 100644--- a/ui/app/shared/locales/nl/or.json+++ b/ui/app/shared/locales/nl/or.json@@ -800,10 +800,10 @@"savePasswordFailed": "Kon wachtwoord niet bijwerken.","userAlreadyExists": "Fout opgetreden! Deze gebruiker bestaat al!","realmAlreadyExists": "Realm naam bestaat al",- "invalidUsername": "De gebruikersnaam mag 3-255 numerieke tekens bevatten","invalidEmail": "Ongeldig emailadres","invalidUrl": "Voer een geldige URL in, bijv. https://example.com","invalidRealm": "De realm naam mag 2-255 numerieke tekens bevatten",+ "invalidCharacters": "Ongeldige lengte of ongeldige tekens gevonden","yes": "Ja","no": "Nee","linked": "Gelinkt",diff --git a/ui/app/shared/locales/pl/or.json b/ui/app/shared/locales/pl/or.jsonindex 8887e80f5..3cb1b9efc 100644--- a/ui/app/shared/locales/pl/or.json+++ b/ui/app/shared/locales/pl/or.json@@ -1084,7 +1084,6 @@"savePasswordFailed": "Nie udało się ustawić hasła.","userAlreadyExists": "Użytkownik o tej nazwie już istnieje.","realmAlreadyExists": "Obszar o tej nazwie już istnieje.",- "invalidUsername": "Nazwa użytkownika musi zawierać od 3 do 255 znaków alfanumerycznych","invalidEmail": "Nieprawidłowy adres e-mail","yes": "Tak","no": "Nie",diff --git a/ui/app/shared/locales/ro/or.json b/ui/app/shared/locales/ro/or.jsonindex b52250506..6a5ca0555 100644--- a/ui/app/shared/locales/ro/or.json+++ b/ui/app/shared/locales/ro/or.json@@ -559,7 +559,6 @@"saveUserSucceeded": "Utilizator salvat cu succes!","userAlreadyExists": "Eroare! Acest utilizator există deja.","realmAlreadyExists": "Numele domeniului există deja",- "invalidUsername": "Numele de utilizator trebuie să fie între 3-255 caractere alfanumerice","invalidEmail": "Adresa e-mail invalidă","yes": "Da","no": "Nu",diff --git a/ui/app/shared/locales/uk/or.json b/ui/app/shared/locales/uk/or.jsonindex 5cc670dce..a17e5ddeb 100644--- a/ui/app/shared/locales/uk/or.json+++ b/ui/app/shared/locales/uk/or.json@@ -827,7 +827,6 @@"savePasswordFailed": "Не вдалося встановити пароль.","userAlreadyExists": "Сталася помилка! Цей користувач вже існує.","realmAlreadyExists": "Реалм з такою назвою вже існує",- "invalidUsername": "Ім'я користувача повинно містити від 3 до 255 буквено-цифрових символів","invalidEmail": "Неправильна адреса електронної пошти","invalidUrl": "Введіть коректний URL, наприклад https://example.com","invalidRealm": "Назва реалму повинна містити від 2 до 255 буквено-цифрових символів",diff --git a/ui/app/storybook/README.md b/ui/app/storybook/README.mdindex 27717434b..d6c050950 100644--- a/ui/app/storybook/README.md+++ b/ui/app/storybook/README.md@@ -3,7 +3,7 @@For documenting and showcasing UI components, we use a tool called [Storybook](https://storybook.js.org/).<br />It can also be used as a workshop during development, or to test if components are working as expected.<br />-When running locally, use `npm run serve` in this directory, and navigate to `http://localhost:9000`.<br />+When running locally, use `npm run serve` in this directory, and navigate to `http://127.0.0.1:9000`.<br />If deployed using Docker, you can access it at `https://<your url>/storybook/`.## Contributingdiff --git a/ui/component/core/README.md b/ui/component/core/README.mdindex 78358ffa1..a660eb87c 100644--- a/ui/component/core/README.md+++ b/ui/component/core/README.md@@ -38,8 +38,8 @@ Initialisation usage example:import openremote from "@openremote/core";openremote.init({- managerUrl: "http://localhost:8080",- keycloakUrl: "http://localhost:8080/auth",+ managerUrl: "http://127.0.0.1:8080",+ keycloakUrl: "http://127.0.0.1:8081/auth",auth: Auth.KEYCLOAK,autoLogin: false,realm: "building",diff --git a/ui/component/core/src/index.ts b/ui/component/core/src/index.tsindex 5b616de37..a205df1f9 100644--- a/ui/component/core/src/index.ts+++ b/ui/component/core/src/index.ts@@ -357,28 +357,27 @@ export class Manager implements EventProviderFactory {if (this._authServerUrl.startsWith("//")) {this._authServerUrl = managerURL.protocol + this._authServerUrl;- }-- try {- authServerURL = new URL(this._authServerUrl);- } catch (e) {- // Could be a relative URL+ this._config.keycloakUrl = this._authServerUrl;+ } else if (this._authServerUrl.startsWith("http")) {+ this._config.keycloakUrl = this._authServerUrl;+ } else {+ // Assume a relative URLauthServerURL = new URL(managerURL);authServerURL.pathname = this._authServerUrl;- }- // Use manager URL info- if (!authServerURL.protocol) {- authServerURL.protocol = managerURL.protocol;- }- if (!authServerURL.hostname) {- authServerURL.hostname = managerURL.hostname;- }- if (!authServerURL.port) {- authServerURL.port = managerURL.port;- }+ // Use manager URL info+ if (!authServerURL.protocol) {+ authServerURL.protocol = managerURL.protocol;+ }+ if (!authServerURL.hostname) {+ authServerURL.hostname = managerURL.hostname;+ }+ if (!authServerURL.port) {+ authServerURL.port = managerURL.port;+ }- this._config.keycloakUrl = authServerURL.toString();+ this._config.keycloakUrl = authServerURL.toString();+ }}// If we still don't know auth server URL then use manager URLdiff --git a/ui/component/index.html b/ui/component/index.htmlindex 251a5764a..f4f383d59 100644--- a/ui/component/index.html+++ b/ui/component/index.html@@ -17,8 +17,8 @@<script>ORCore.manager.init({- managerUrl: "http://localhost:8080",- keycloakUrl: "http://localhost:8080/auth",+ managerUrl: "http://127.0.0.1:8080",+ keycloakUrl: "http://127.0.0.1:8081/auth",auth: "KEYCLOAK",autoLogin: true,loadIcons: true,diff --git a/ui/component/or-chart/stories/chart.stories.ts b/ui/component/or-chart/stories/chart.stories.tsindex d13da95cd..2f8df6884 100644--- a/ui/component/or-chart/stories/chart.stories.ts+++ b/ui/component/or-chart/stories/chart.stories.ts@@ -158,7 +158,7 @@ async function loadOrChart(storyArgs: any) {}async function loadOrManager() {- if (await manager.init({ managerUrl: "http://localhost:8080", realm: "smartcity" })) {+ if (await manager.init({ managerUrl: "http://127.0.0.1:8080", realm: "smartcity" })) {if (!manager.authenticated) {manager.login();}diff --git a/ui/component/or-dashboard-builder/src/widgets/gateway-widget.ts b/ui/component/or-dashboard-builder/src/widgets/gateway-widget.tsindex cb37f9411..9b928296c 100644--- a/ui/component/or-dashboard-builder/src/widgets/gateway-widget.ts+++ b/ui/component/or-dashboard-builder/src/widgets/gateway-widget.ts@@ -60,7 +60,7 @@ function getDefaultWidgetConfig(): GatewayWidgetConfig {return {attributeRefs: [],type: GatewayTunnelInfoType.HTTPS,- target: "localhost",+ target: "127.0.0.1",targetPort: 443,};}diff --git a/ui/component/or-map/stories/map.stories.ts b/ui/component/or-map/stories/map.stories.tsindex 3b91229e6..d71746c37 100644--- a/ui/component/or-map/stories/map.stories.ts+++ b/ui/component/or-map/stories/map.stories.ts@@ -115,7 +115,7 @@ export { customElements, packageJson };/* ------------------------------------------------------- */async function loadOrManager() {- if (await manager.init({ managerUrl: "http://localhost:8080", realm: "smartcity" })) {+ if (await manager.init({ managerUrl: "http://127.0.0.1:8080", realm: "smartcity" })) {if (!manager.authenticated) {manager.login();}diff --git a/ui/component/or-scheduler/stories/or-scheduler.stories.ts b/ui/component/or-scheduler/stories/or-scheduler.stories.tsindex 49d7557aa..1a2489511 100644--- a/ui/component/or-scheduler/stories/or-scheduler.stories.ts+++ b/ui/component/or-scheduler/stories/or-scheduler.stories.ts@@ -92,7 +92,7 @@ export { customElements, packageJson };/* ------------------------------------------------------- */async function loadOrManager() {- if (await manager.init({ managerUrl: "http://localhost:8080", realm: "master" })) {+ if (await manager.init({ managerUrl: "http://127.0.0.1:8080", realm: "master" })) {if (!manager.authenticated) {manager.login();}diff --git a/ui/component/or-translate/stories/or-translate.stories.ts b/ui/component/or-translate/stories/or-translate.stories.tsindex f73e8affa..d47aff918 100644--- a/ui/component/or-translate/stories/or-translate.stories.ts+++ b/ui/component/or-translate/stories/or-translate.stories.ts@@ -72,10 +72,10 @@ async function loadOrTranslate(storyArgs: any) {console.debug("Loading OrTranslate...");const orTranslate = Object.assign(new OrTranslate(), storyArgs);console.debug("Waiting for i18next initialization...");- if (window.location.href.includes("localhost")) {+ if (window.location.href.includes("127.0.0.1")) {await i18next.use(i18nextBackend)- .init({ lng: "en", backend: { loadPath: () => "http://localhost:8080/shared/locales/{{lng}}/or.json" } });+ .init({ lng: "en", backend: { loadPath: () => "http://127.0.0.1:8080/shared/locales/{{lng}}/or.json" } });} else {await i18next.use(i18nextBackend)diff --git a/ui/component/or-tree-menu/src/model.ts b/ui/component/or-tree-menu/src/model.tsindex 3777124ad..62b7064f6 100644--- a/ui/component/or-tree-menu/src/model.ts+++ b/ui/component/or-tree-menu/src/model.ts@@ -92,9 +92,9 @@ export class OrTreeDragEvent extends CustomEvent<OrTreeGroupEventDetail> {composed: true,cancelable: true,detail: {- nodes,- groupNode,- newNodes+ nodes: nodes,+ groupNode: groupNode,+ newNodes: newNodes} as OrTreeGroupEventDetail});}diff --git a/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts b/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.tsindex 5b93bf9b1..b0658a32d 100644--- a/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts+++ b/ui/component/or-vaadin-components/stories/or-vaadin-dialog.stories.ts@@ -117,7 +117,7 @@ export { customElements, packageJson };/* ------------------------------------------------------- */async function loadOrManager() {- if (await manager.init({ managerUrl: "http://localhost:8080", realm: "smartcity" })) {+ if (await manager.init({ managerUrl: "http://127.0.0.1:8080", realm: "smartcity" })) {if (!manager.authenticated) {manager.login();}diff --git a/ui/demo/demo-core/src/index.ts b/ui/demo/demo-core/src/index.tsindex f947c1dfd..3d439af28 100644--- a/ui/demo/demo-core/src/index.ts+++ b/ui/demo/demo-core/src/index.ts@@ -171,7 +171,7 @@ class OrDemo extends subscribe(manager)(LitElement) {manager.init({- managerUrl: "http://localhost:8080",+ managerUrl: "http://127.0.0.1:8080",auth: Auth.KEYCLOAK,autoLogin: false,realm: "smartcity",diff --git a/ui/demo/demo-rest/src/index.ts b/ui/demo/demo-rest/src/index.tsindex e47685dbc..eab287da7 100644--- a/ui/demo/demo-rest/src/index.ts+++ b/ui/demo/demo-rest/src/index.ts@@ -67,7 +67,7 @@ manager.addListener((event) => {manager.init({- managerUrl: "http://localhost:8080",+ managerUrl: "http://127.0.0.1:8080",auth: Auth.KEYCLOAK,autoLogin: true,realm: "smartcity",diff --git a/ui/test/app.config.cts b/ui/test/app.config.ctsindex 70f8c2ce7..db65741fe 100644--- a/ui/test/app.config.cts+++ b/ui/test/app.config.cts@@ -76,7 +76,7 @@ export const defineAppConfig = (path: string) => {/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */use: {// Defaults to the default Manager Docker container port as that significantly speeds up the tests compared to serving the frontend with Webpack- baseURL: managerUrl || DEV ? "http://localhost:9000" : "http://localhost:8080",+ baseURL: managerUrl || DEV ? "http://127.0.0.1:9000" : "http://127.0.0.1:8080",/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */trace: "retain-on-failure",video: "on",@@ -84,7 +84,7 @@ export const defineAppConfig = (path: string) => {},webServer: {command: `node ${join(__dirname, "manager.cjs")}`,- url: "http://localhost:8080",+ url: "http://127.0.0.1:8080",reuseExistingServer: !process.env.CI,},workers: 1,diff --git a/ui/test/plugin/rspackUtils.ts b/ui/test/plugin/rspackUtils.tsindex a70f9e713..6ac1275c8 100644--- a/ui/test/plugin/rspackUtils.ts+++ b/ui/test/plugin/rspackUtils.ts@@ -59,7 +59,7 @@ export async function resolveDirs(configDir: string, use: CtConfig) {}export function resolveEndpoint(use: CtConfig) {- const baseURL = new URL(use.baseURL || "http://localhost");+ const baseURL = new URL(use.baseURL || "http://127.0.0.1");return {https: baseURL.protocol.startsWith("https:"),host: baseURL.hostname,diff --git a/ui/util/rspack.util.js b/ui/util/rspack.util.jsindex 157793654..3d4d386a2 100644--- a/ui/util/rspack.util.js+++ b/ui/util/rspack.util.js@@ -63,7 +63,7 @@ function getStandardModuleRules() {function getAppConfig(mode, isDevServer, dirname, managerUrl, keycloakUrl, port) {const production = mode === "production";port = port || 9000;- managerUrl = managerUrl || (production && !isDevServer ? undefined : "http://localhost:8080");+ managerUrl = managerUrl || (production && !isDevServer ? undefined : "http://127.0.0.1:8080");const OUTPUT_PATH = isDevServer ? "src" : "dist";if (isDevServer) {@@ -71,8 +71,8 @@ function getAppConfig(mode, isDevServer, dirname, managerUrl, keycloakUrl, port)console.log("To customise the URL of the manager and/or keycloak use the managerUrl and/or keycloakUrl");console.log(" environment arguments e.g: ");console.log("");- console.log("npm run serve -- --env managerUrl=https://localhost");- console.log("npm run serve -- --env keycloakUrl=https://localhost/auth");+ console.log("npm run serve -- --env managerUrl=https://127.0.0.1");+ console.log("npm run serve -- --env keycloakUrl=https://127.0.0.1/auth");console.log("");console.log("MANAGER URL: " + managerUrl || "");console.log("KEYCLOAK URL: " + keycloakUrl || managerUrl + "/auth");