Add specific modules
parent
f052d14bac
commit
1735c1499e
|
|
@ -97,7 +97,9 @@
|
|||
</includes>
|
||||
</resource>
|
||||
</webResources>
|
||||
<packagingExcludes>WEB-INF/lib/wsmaster-local*.jar,</packagingExcludes>
|
||||
<packagingExcludes>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</packagingExcludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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
|
||||
*/
|
||||
|
|
|
|||
Loading…
Reference in New Issue