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
Fixes for running in development
Rich Turner8214456e72d9
diff --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 c10fd56e1..4d4774071 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@@ -150,7 +150,8 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {UriBuilder.fromPath("/").scheme("http").host(getString(container.getConfig(), KEYCLOAK_HOST, KEYCLOAK_HOST_DEFAULT))- .port(getInteger(container.getConfig(), KEYCLOAK_PORT, KEYCLOAK_PORT_DEFAULT));+ .port(getInteger(container.getConfig(), KEYCLOAK_PORT, KEYCLOAK_PORT_DEFAULT))+ .path("auth");LOG.info("Keycloak service URL: " + keycloakServiceUri.build());@@ -171,7 +172,7 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {WebTargetBuilder targetBuilder = new WebTargetBuilder(httpClient, keycloakServiceUri.build());targetBuilder.setOAuthAuthentication(new OAuthPasswordGrant(- keycloakServiceUri.clone().path("/auth/realms/master/protocol/openid-connect/token").build().toString(),+ keycloakServiceUri.clone().path("/realms/master/protocol/openid-connect/token").build().toString(),ADMIN_CLI_CLIENT_ID,null,"openid",@@ -325,7 +326,7 @@ public abstract class KeycloakIdentityProvider implements IdentityProvider {// The auth-server-url in the adapter config must be reachable by this manageradapterConfig.setAuthServerUrl(- keycloakServiceUri.clone().replacePath("auth").build().toString()+ keycloakServiceUri.clone().build().toString());return KeycloakDeploymentBuilder.build(adapterConfig);diff --git a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakResource.java b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakResource.javaindex 9b2d749a6..5d6cd535e 100644--- a/container/src/main/java/org/openremote/container/security/keycloak/KeycloakResource.java+++ b/container/src/main/java/org/openremote/container/security/keycloak/KeycloakResource.java@@ -30,7 +30,6 @@ import javax.ws.rs.core.Response;import static javax.ws.rs.core.MediaType.*;-@Path("auth")public interface KeycloakResource {@GETdiff --git a/profile/dev-testing.yml b/profile/dev-testing.ymlindex c1b0c5db4..529fa579d 100644--- a/profile/dev-testing.yml+++ b/profile/dev-testing.yml@@ -24,6 +24,8 @@ services:depends_on:postgresql:condition: service_healthy+ environment:+ KEYCLOAK_FRONTEND_URL: 'http://localhost:8081/auth'postgresql:extends:diff --git a/ui/component/or-app/src/index.ts b/ui/component/or-app/src/index.tsindex 312a9fa82..77332fbc3 100644--- a/ui/component/or-app/src/index.ts+++ b/ui/component/or-app/src/index.ts@@ -35,8 +35,9 @@ export * from "./app";export * from "./or-header";export * from "./types";-// Declare MANAGER_URL - Global var injected by webpack+// Declare MANAGER_URL and KEYCLOAK_URL - Global var injected by webpackdeclare var MANAGER_URL: string | undefined;+declare var KEYCLOAK_URL: string | undefined;export {HeaderConfig};@@ -55,6 +56,7 @@ export function getRealmQueryParameter(): string | undefined {const DEFAULT_MANAGER_CONFIG: ManagerConfig = {managerUrl: MANAGER_URL,+ keycloakUrl: KEYCLOAK_URL,auth: Auth.KEYCLOAK,autoLogin: true,realm: getRealmQueryParameter(),diff --git a/ui/util/webpack.util.js b/ui/util/webpack.util.jsindex a9e8207a3..4fcbbd978 100644--- a/ui/util/webpack.util.js+++ b/ui/util/webpack.util.js@@ -4,9 +4,10 @@ const webpack = require("webpack");const CopyWebpackPlugin = require("copy-webpack-plugin");const HtmlWebpackPlugin = require("html-webpack-plugin");-function getAppConfig(mode, isDevServer, dirname, managerUrl) {+function getAppConfig(mode, isDevServer, dirname, managerUrl, keycloakUrl) {const production = mode === "production";managerUrl = managerUrl || (production ? undefined : "http://localhost:8080");+ keycloakUrl = keycloakUrl || (production ? undefined : "http://localhost:8081/auth");const OUTPUT_PATH = isDevServer ? 'src' : 'dist';const config = {@@ -89,6 +90,7 @@ function getAppConfig(mode, isDevServer, dirname, managerUrl) {new webpack.DefinePlugin({PRODUCTION: JSON.stringify(production),MANAGER_URL: JSON.stringify(managerUrl),+ KEYCLOAK_URL: JSON.stringify(keycloakUrl),"process.env": {BABEL_ENV: JSON.stringify(mode)}