Revert "Revert "Fix patch with master""

This reverts commit 5fb9d0bb42.
6.19.x
Max Shaposhnik 2017-07-13 11:56:10 +03:00
parent 5fb9d0bb42
commit 09837c32be
11 changed files with 89 additions and 41 deletions

View File

@ -104,7 +104,7 @@
<appendAssemblyId>false</appendAssemblyId>
<updateOnly>false</updateOnly>
<descriptors>
<descriptor>${project.basedir}/src/assembly/assembly.xml</descriptor>
<descriptor>${project.basedir}/src/assembly/assembly.xml</descriptor>
</descriptors>
<finalName>eclipse-che-${project.version}</finalName>
<tarLongFileMode>posix</tarLongFileMode>

View File

@ -32,6 +32,18 @@
<artifactId>assembly-wsmaster-war</artifactId>
<type>war</type>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-workspace</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-api-workspace</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-machine-authentication</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-keycloak-server</artifactId>

View File

@ -1,8 +1,8 @@
--- src/app/index.module.ts
+++ src/app/index.module.ts
@@ -32,12 +32,36 @@
import {StacksConfig} from './stacks/stacks-config';
import {DemoComponentsCtrl} from './demo-components/demo-components.controller';
@@ -36,12 +36,36 @@
import {CheBranding} from '../components/branding/che-branding.factory';
import {ChePreferences} from '../components/api/che-preferences.factory';
-
+import * as Keycloak from '../components/keycloak/keycloak';
+

View File

@ -93,6 +93,10 @@
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-core-commons-schedule</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-machine-authentication</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.che.plugin</groupId>
<artifactId>che-plugin-docker-client</artifactId>

View File

@ -84,6 +84,8 @@ public class DockerInstanceRuntimeInfo implements MachineRuntimeInfo {
*/
public static final String USER_TOKEN = "USER_TOKEN";
public static final String MACHINE_TOKEN = "MACHINE_TOKEN";
private final ContainerInfo info;
private final Map<String, ServerConfImpl> serversConf;
private final String internalHost;

View File

@ -76,6 +76,7 @@ import org.eclipse.che.plugin.docker.client.params.network.ConnectContainerToNet
import org.eclipse.che.plugin.docker.client.params.network.CreateNetworkParams;
import org.eclipse.che.plugin.docker.client.params.network.RemoveNetworkParams;
import org.eclipse.che.plugin.docker.machine.node.DockerNode;
import org.eclipse.che.machine.authentication.server.MachineTokenRegistry;
import org.slf4j.Logger;
import javax.inject.Inject;
@ -149,6 +150,7 @@ public class MachineProviderImpl implements MachineInstanceProvider {
private final DockerInstanceStopDetector dockerInstanceStopDetector;
private final RequestTransmitter transmitter;
private final JsonRpcEndpointToMachineNameHolder jsonRpcEndpointToMachineNameHolder;
private final MachineTokenRegistry machineTokenRegistry;
private final boolean doForcePullImage;
private final boolean privilegedMode;
private final int pidsLimit;
@ -179,6 +181,7 @@ public class MachineProviderImpl implements MachineInstanceProvider {
DockerInstanceStopDetector dockerInstanceStopDetector,
RequestTransmitter transmitter,
JsonRpcEndpointToMachineNameHolder jsonRpcEndpointToMachineNameHolder,
MachineTokenRegistry machineTokenRegistry,
@Named("machine.docker.dev_machine.machine_servers") Set<ServerConf> devMachineServers,
@Named("machine.docker.machine_servers") Set<ServerConf> allMachinesServers,
@Named("machine.docker.dev_machine.machine_volumes") Set<String> devMachineSystemVolumes,
@ -204,6 +207,7 @@ public class MachineProviderImpl implements MachineInstanceProvider {
this.docker = dockerProvider.get();
this.dockerCredentials = dockerCredentials;
this.dockerMachineFactory = dockerMachineFactory;
this.machineTokenRegistry = machineTokenRegistry;
this.dockerInstanceStopDetector = dockerInstanceStopDetector;
this.transmitter = transmitter;
this.doForcePullImage = doForcePullImage;
@ -658,6 +662,7 @@ public class MachineProviderImpl implements MachineInstanceProvider {
env = new HashMap<>(devMachineEnvVariables);
env.put(DockerInstanceRuntimeInfo.USER_TOKEN, getUserToken(workspaceId));
env.put(DockerInstanceRuntimeInfo.MACHINE_TOKEN, getMachineToken(workspaceId));
} else {
portsToExpose = commonMachinePortsToExpose;
env = new HashMap<>(commonMachineEnvVariables);
@ -788,6 +793,15 @@ 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
*/

View File

@ -44,6 +44,7 @@ import org.eclipse.che.plugin.docker.client.params.RemoveImageParams;
import org.eclipse.che.plugin.docker.client.params.StartContainerParams;
import org.eclipse.che.plugin.docker.client.params.TagParams;
import org.eclipse.che.plugin.docker.machine.node.DockerNode;
import org.eclipse.che.machine.authentication.server.MachineTokenRegistry;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.testng.MockitoTestNGListener;
@ -143,6 +144,9 @@ public class MachineProviderImplTest {
@Mock
private RecipeRetriever recipeRetriever;
@Mock
private MachineTokenRegistry tokenRegistry;
@Mock
private WindowsPathEscaper pathEscaper;
@ -1784,6 +1788,7 @@ public class MachineProviderImplTest {
dockerInstanceStopDetector,
transmitter,
jsonRpcEndpointToMachineNameHolder,
tokenRegistry,
devMachineServers,
allMachineServers,
devMachineVolumes,
@ -1807,7 +1812,6 @@ public class MachineProviderImplTest {
emptyMap()));
doNothing().when(provider).readContainerLogsInSeparateThread(anyString(), anyString(),
anyString(), any(LineConsumer.class));
return provider;
}
}

View File

@ -246,31 +246,31 @@
</build>
<profiles>
<profile>
<id>integration</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/maven/server/**</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<id>integration</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
<configuration>
<includes>
<include>**/maven/server/**</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>

10
pom.xml
View File

@ -528,6 +528,16 @@
<artifactId>che-ide-core</artifactId>
<version>${che.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-machine-authentication</artifactId>
<version>${che.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-machine-authentication-shared</artifactId>
<version>${che.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.che.core</groupId>
<artifactId>che-wsagent-core</artifactId>

View File

@ -29,10 +29,10 @@
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
@ -137,12 +137,12 @@
<exclude>**/JsonUtil.java</exclude>
<exclude>**/DtoConversionTest.java</exclude>
<exclude>**/LanguageDescription.java</exclude>
<exclude>**/ServerCapabilitiesOverlay.java</exclude>
<exclude>**/DocumentFilter.java</exclude>
<exclude>**/CheLanguageClient.java</exclude>
<exclude>**/LanguageServerDescription.java</exclude>
<exclude>**/LSOperation.java</exclude>
<exclude>**/OperationUtil.java</exclude>
<exclude>**/ServerCapabilitiesOverlay.java</exclude>
<exclude>**/DocumentFilter.java</exclude>
<exclude>**/CheLanguageClient.java</exclude>
<exclude>**/LanguageServerDescription.java</exclude>
<exclude>**/LSOperation.java</exclude>
<exclude>**/OperationUtil.java</exclude>
</excludes>
</configuration>
</plugin>

View File

@ -44,5 +44,7 @@
<module>integration-tests</module>
<module>che-core-api-system</module>
<module>che-core-api-system-shared</module>
<module>che-machine-authentication-shared</module>
<module>che-machine-authentication</module>
</modules>
</project>