use of org.keycloak.connections.httpclient.ProxyMappings.ProxyMapping in project keycloak by keycloak.
the class ProxyMappingsTest method shouldReturnProxy1ForConfiguredProxyMappingAlternative.
@Test
public void shouldReturnProxy1ForConfiguredProxyMappingAlternative() {
ProxyMapping proxy = proxyMappings.getProxyFor("www.googleapis.com");
assertThat(proxy.getProxyHost(), is(notNullValue()));
assertThat(proxy.getProxyHost().getHostName(), is("proxy1"));
}
use of org.keycloak.connections.httpclient.ProxyMappings.ProxyMapping in project keycloak by keycloak.
the class ProxyMappingsTest method shouldReturnMappingForHttpProxy.
@Test
public void shouldReturnMappingForHttpProxy() {
ProxyMappings proxyMappings = ProxyMappings.withFixedProxyMapping("https://some-proxy.redhat.com:8080", null);
ProxyMapping forGoogle = proxyMappings.getProxyFor("login.google.com");
assertEquals("some-proxy.redhat.com", forGoogle.getProxyHost().getHostName());
}
use of org.keycloak.connections.httpclient.ProxyMappings.ProxyMapping in project keycloak by keycloak.
the class ProxyMappingsTest method shouldReturnProxy2ForConfiguredProxyMapping.
@Test
public void shouldReturnProxy2ForConfiguredProxyMapping() {
ProxyMapping proxy = proxyMappings.getProxyFor("login.facebook.com");
assertThat(proxy.getProxyHost(), is(notNullValue()));
assertThat(proxy.getProxyHost().getHostName(), is("proxy2"));
}
use of org.keycloak.connections.httpclient.ProxyMappings.ProxyMapping in project keycloak by keycloak.
the class ProxyMappingsTest method shouldReturnFallbackForNotExplicitlyMappedHostname.
@Test
public void shouldReturnFallbackForNotExplicitlyMappedHostname() {
ProxyMappings proxyMappingsWithFallback = ProxyMappings.valueOf(MAPPINGS_WITH_FALLBACK);
ProxyMapping proxy = proxyMappingsWithFallback.getProxyFor("login.salesforce.com");
assertThat(proxy.getProxyHost().getHostName(), is("fallback"));
}
use of org.keycloak.connections.httpclient.ProxyMappings.ProxyMapping in project keycloak by keycloak.
the class ProxyMappingsTest method shouldReturnFallbackForNotExplicitlyMappedHostnameAndHonorProxyExceptions.
@Test
public void shouldReturnFallbackForNotExplicitlyMappedHostnameAndHonorProxyExceptions() {
ProxyMappings proxyMappingsWithFallbackAndProxyException = ProxyMappings.valueOf(MAPPINGS_WITH_FALLBACK_AND_PROXY_EXCEPTION);
ProxyMapping forGoogle = proxyMappingsWithFallbackAndProxyException.getProxyFor("login.google.com");
assertThat(forGoogle.getProxyHost().getHostName(), is("proxy1"));
ProxyMapping forFacebook = proxyMappingsWithFallbackAndProxyException.getProxyFor("login.facebook.com");
assertThat(forFacebook.getProxyHost().getHostName(), is("proxy2"));
ProxyMapping forAcmeCorp = proxyMappingsWithFallbackAndProxyException.getProxyFor("myapp.acme.corp.com");
assertThat(forAcmeCorp.getProxyHost(), is(nullValue()));
ProxyMapping forMicrosoft = proxyMappingsWithFallbackAndProxyException.getProxyFor("login.microsoft.com");
assertThat(forMicrosoft.getProxyHost().getHostName(), is("fallback"));
ProxyMapping forSalesForce = proxyMappingsWithFallbackAndProxyException.getProxyFor("login.salesforce.com");
assertThat(forSalesForce.getProxyHost().getHostName(), is("fallback"));
}
Aggregations