use of org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.jwtproxy.factory.JwtProxyConfigBuilderFactory in project devspaces-images by redhat-developer.
the class PassThroughProxyProvisionerTest method shouldConfigureProxyWithExcludes.
// PassThroughProxyProvisioner shares much of the codebase with the JwtProxyProvisioner. We only
// test the different behavior here, while the majority of the tests are present in the
// JwtProxyProvisionerTest
@Test
public void shouldConfigureProxyWithExcludes() throws Exception {
// given
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().build();
JwtProxyConfigBuilderFactory configBuilderFactory = mock(JwtProxyConfigBuilderFactory.class);
JwtProxyConfigBuilder configBuilder = mock(JwtProxyConfigBuilder.class);
when(configBuilderFactory.create(any())).thenReturn(configBuilder);
ServiceExposureStrategyProvider exposureStrategyProvider = mock(ServiceExposureStrategyProvider.class);
when(exposureStrategyProvider.get()).thenReturn(mock(ExternalServiceExposureStrategy.class));
when(exposureStrategyProvider.getMultiHostStrategy()).thenReturn(mock(ExternalServiceExposureStrategy.class));
PassThroughProxyProvisioner passThroughProxyProvisioner = new PassThroughProxyProvisioner(configBuilderFactory, exposureStrategyProvider, new CookiePathStrategy(MULTI_HOST_STRATEGY), new MultiHostCookiePathStrategy(), "eclipse/che-jwtproxy", "10m", "128mb", "0.02", "0.5", "Always", runtimeId);
Map<String, String> attrs = new HashMap<>();
ServerConfig.setCookiesAuthEnabled(attrs, true);
ServerConfig.setSecure(attrs, true);
ServerConfigImpl server1 = new ServerConfigImpl("4401/tcp", "http", "/", attrs);
ServicePort port = new ServicePort();
port.setTargetPort(new IntOrString(8080));
// when
passThroughProxyProvisioner.expose(k8sEnv, podWithName(), "machine", "terminal", port, "TCP", false, ImmutableMap.of("server1", server1));
// then
verify(configBuilder).addVerifierProxy(eq(4400), eq("http://terminal:8080"), eq(singleton("/")), eq(false), eq("/"), isNull());
}
use of org.eclipse.che.workspace.infrastructure.kubernetes.server.secure.jwtproxy.factory.JwtProxyConfigBuilderFactory in project che-server by eclipse-che.
the class PassThroughProxyProvisionerTest method shouldConfigureProxyWithExcludes.
// PassThroughProxyProvisioner shares much of the codebase with the JwtProxyProvisioner. We only
// test the different behavior here, while the majority of the tests are present in the
// JwtProxyProvisionerTest
@Test
public void shouldConfigureProxyWithExcludes() throws Exception {
// given
KubernetesEnvironment k8sEnv = KubernetesEnvironment.builder().build();
JwtProxyConfigBuilderFactory configBuilderFactory = mock(JwtProxyConfigBuilderFactory.class);
JwtProxyConfigBuilder configBuilder = mock(JwtProxyConfigBuilder.class);
when(configBuilderFactory.create(any())).thenReturn(configBuilder);
ServiceExposureStrategyProvider exposureStrategyProvider = mock(ServiceExposureStrategyProvider.class);
when(exposureStrategyProvider.get()).thenReturn(mock(ExternalServiceExposureStrategy.class));
when(exposureStrategyProvider.getMultiHostStrategy()).thenReturn(mock(ExternalServiceExposureStrategy.class));
PassThroughProxyProvisioner passThroughProxyProvisioner = new PassThroughProxyProvisioner(configBuilderFactory, exposureStrategyProvider, new CookiePathStrategy(MULTI_HOST_STRATEGY), new MultiHostCookiePathStrategy(), "eclipse/che-jwtproxy", "10m", "128mb", "0.02", "0.5", "Always", runtimeId);
Map<String, String> attrs = new HashMap<>();
ServerConfig.setCookiesAuthEnabled(attrs, true);
ServerConfig.setSecure(attrs, true);
ServerConfigImpl server1 = new ServerConfigImpl("4401/tcp", "http", "/", attrs);
ServicePort port = new ServicePort();
port.setTargetPort(new IntOrString(8080));
// when
passThroughProxyProvisioner.expose(k8sEnv, podWithName(), "machine", "terminal", port, "TCP", false, ImmutableMap.of("server1", server1));
// then
verify(configBuilder).addVerifierProxy(eq(4400), eq("http://terminal:8080"), eq(singleton("/")), eq(false), eq("/"), isNull());
}
Aggregations