diff --git a/assembly-multiuser/assembly-wsmaster-war/pom.xml b/assembly-multiuser/assembly-wsmaster-war/pom.xml index 39d39236ef..505b0b9274 100644 --- a/assembly-multiuser/assembly-wsmaster-war/pom.xml +++ b/assembly-multiuser/assembly-wsmaster-war/pom.xml @@ -97,7 +97,9 @@ - WEB-INF/lib/wsmaster-local*.jar, + WEB-INF/lib/wsmaster-local*.jar, + WEB-INF/classes/org/eclipse/che/api/deploy/CheWsMasterModule.class, + WEB-INF/classes/org/eclipse/che/api/deploy/CheWsMasterServletModule.class diff --git a/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthModule.java b/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthModule.java index b83d6562e2..95b1d4e13e 100644 --- a/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthModule.java +++ b/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthModule.java @@ -21,7 +21,9 @@ import org.eclipse.che.machine.authentication.server.MachineAuthLinksInjector; import org.eclipse.che.machine.authentication.server.interceptor.InterceptorModule; /** - * @author Max Shaposhnik (mshaposhnik@codenvy.com) + * Machine authentification bindings. + * + * @author Max Shaposhnik (mshaposh@redhat.com) */ @DynaModule public class MachineAuthModule extends AbstractModule { diff --git a/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthServletModule.java b/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthServletModule.java index 41ab90c7d9..862cda00a6 100644 --- a/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthServletModule.java +++ b/assembly-multiuser/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/MachineAuthServletModule.java @@ -16,7 +16,9 @@ import org.eclipse.che.inject.DynaModule; import org.eclipse.che.machine.authentication.server.MachineLoginFilter; /** - * @author Max Shaposhnik (mshaposhnik@codenvy.com). + * Machine authentification bindings. + * + * @author Max Shaposhnik (mshaposh@redhat.com) */ @DynaModule public class MachineAuthServletModule extends ServletModule { diff --git a/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterModule.java b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterModule.java new file mode 100644 index 0000000000..41d441dde2 --- /dev/null +++ b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterModule.java @@ -0,0 +1,37 @@ +/******************************************************************************* + * Copyright (c) 2012-2017 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.deploy; + +import com.google.inject.AbstractModule; + +import org.eclipse.che.api.user.server.TokenValidator; +import org.eclipse.che.inject.DynaModule; + +/** + * + * Single-user version Che specific bindings + * + * @author Max Shaposhnik (mshaposh@redhat.com) + */ +@DynaModule +public class CheWsMasterModule extends AbstractModule { + @Override + protected void configure() { + + bind(TokenValidator.class).to(org.eclipse.che.api.local.DummyTokenValidator.class); + + bind(org.eclipse.che.api.agent.server.WsAgentHealthChecker.class) + .to(org.eclipse.che.api.agent.server.WsAgentHealthCheckerImpl.class); + + bind(org.eclipse.che.api.environment.server.MachineInstanceProvider.class) + .to(org.eclipse.che.plugin.docker.machine.MachineProviderImpl.class); + } +} diff --git a/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterServletModule.java b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterServletModule.java new file mode 100644 index 0000000000..6f0b3f1f3b --- /dev/null +++ b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/CheWsMasterServletModule.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2012-2017 Codenvy, S.A. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Codenvy, S.A. - initial API and implementation + *******************************************************************************/ +package org.eclipse.che.api.deploy; + +import com.google.inject.servlet.ServletModule; + +import org.eclipse.che.inject.DynaModule; + +/** + * Single-user version Che specific bindings + * + * @author Max Shaposhnik (mshaposh@redhat.com) + * + */ +@DynaModule +public class CheWsMasterServletModule extends ServletModule { + + @Override + protected void configureServlets() { + filter("/api/*").through(org.eclipse.che.api.local.filters.EnvironmentInitializationFilter.class); + } +} diff --git a/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/WsMasterModule.java b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/WsMasterModule.java index a76f594830..5ab20dea25 100644 --- a/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/WsMasterModule.java +++ b/assembly/assembly-wsmaster-war/src/main/java/org/eclipse/che/api/deploy/WsMasterModule.java @@ -130,10 +130,6 @@ public class WsMasterModule extends AbstractModule { new org.eclipse.che.api.machine.server.model.impl.ServerConfImpl(Constants.WSAGENT_DEBUG_REFERENCE, "4403/tcp", "http", null)); - //TODO: overridden in auth module -// bind(org.eclipse.che.api.agent.server.WsAgentHealthChecker.class) -// .to(org.eclipse.che.api.agent.server.WsAgentHealthCheckerImpl.class); - bind(org.eclipse.che.api.machine.server.recipe.RecipeLoader.class); Multibinder.newSetBinder(binder(), String.class, Names.named(RecipeLoader.CHE_PREDEFINED_RECIPES)) .addBinding().toInstance("predefined-recipes.json"); @@ -185,9 +181,6 @@ public class WsMasterModule extends AbstractModule { install(new org.eclipse.che.api.workspace.server.activity.inject.WorkspaceActivityModule()); - bind(org.eclipse.che.api.environment.server.MachineInstanceProvider.class) - .to(org.eclipse.che.plugin.docker.machine.MachineProviderImpl.class); - install(new org.eclipse.che.api.core.rest.CoreRestModule()); install(new org.eclipse.che.api.core.util.FileCleaner.FileCleanerModule()); install(new org.eclipse.che.plugin.docker.machine.local.LocalDockerModule()); diff --git a/plugins/plugin-docker/che-plugin-docker-machine/src/main/java/org/eclipse/che/plugin/docker/machine/MachineProviderImpl.java b/plugins/plugin-docker/che-plugin-docker-machine/src/main/java/org/eclipse/che/plugin/docker/machine/MachineProviderImpl.java index 9074ce84e9..9fc1167e22 100644 --- a/plugins/plugin-docker/che-plugin-docker-machine/src/main/java/org/eclipse/che/plugin/docker/machine/MachineProviderImpl.java +++ b/plugins/plugin-docker/che-plugin-docker-machine/src/main/java/org/eclipse/che/plugin/docker/machine/MachineProviderImpl.java @@ -661,7 +661,7 @@ public class MachineProviderImpl implements MachineInstanceProvider { volumes = devMachineSystemVolumes; env = new HashMap<>(devMachineEnvVariables); - env.put(DockerInstanceRuntimeInfo.USER_TOKEN, getMachineToken(workspaceId)); + env.put(DockerInstanceRuntimeInfo.USER_TOKEN, getUserToken(workspaceId)); } else { portsToExpose = commonMachinePortsToExpose; env = new HashMap<>(commonMachineEnvVariables); @@ -792,15 +792,6 @@ public class MachineProviderImpl implements MachineInstanceProvider { return EnvironmentContext.getCurrent().getSubject().getToken(); } - protected String getMachineToken(String wsId) { - String userToken = null; - try { - userToken = machineTokenRegistry.getOrCreateToken(EnvironmentContext.getCurrent().getSubject().getUserId(), wsId); - } catch (NotFoundException ignore) { - } - return MoreObjects.firstNonNull(userToken, ""); - } - /** * Returns set that contains all non empty and non nullable values from specified set */