From f665e57730239b437ffd980a5fd100539b619593 Mon Sep 17 00:00:00 2001 From: Tobia De Koninck Date: Mon, 9 Nov 2020 16:16:50 +0100 Subject: [PATCH] Pass proxy realm id to Shiny Apps --- .../containerproxy/backend/AbstractContainerBackend.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java b/src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java index 90ba0cea..c673aee0 100644 --- a/src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java +++ b/src/main/java/eu/openanalytics/containerproxy/backend/AbstractContainerBackend.java @@ -68,6 +68,7 @@ public abstract class AbstractContainerBackend implements IContainerBackend { //TODO rename vars? protected static final String ENV_VAR_USER_NAME = "SHINYPROXY_USERNAME"; protected static final String ENV_VAR_USER_GROUPS = "SHINYPROXY_USERGROUPS"; + protected static final String ENV_VAR_REALM_ID = "SHINYPROXY_REALM_ID"; protected final Logger log = LogManager.getLogger(getClass()); @@ -191,6 +192,11 @@ protected List buildEnv(ContainerSpec containerSpec, Proxy proxy) throws String[] groups = userService.getGroups(userService.getCurrentAuth()); env.add(String.format("%s=%s", ENV_VAR_USER_GROUPS, Arrays.stream(groups).collect(Collectors.joining(",")))); + String realmId = environment.getProperty("proxy.realm-id"); + if (realmId != null) { + env.add(String.format("%s=%s", ENV_VAR_REALM_ID, realmId)); + } + String envFile = containerSpec.getEnvFile(); if (envFile != null && Files.isRegularFile(Paths.get(envFile))) { Properties envProps = new Properties();