use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigProviderTest method testWithoutAuthPasswordSetProxy.
@Test
public void testWithoutAuthPasswordSetProxy() {
ProxyConfig proxyConfig = new ProxyConfig();
proxyConfig.setPassword("test");
Map<String, Object> properties = testProxyCore(proxyConfig);
assertFalse(properties.containsKey("user"));
assertFalse(properties.containsKey("password"));
}
use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigProvider method decoratePillarWithProxyDataIfNeeded.
@Transactional
public void decoratePillarWithProxyDataIfNeeded(Map<String, SaltPillarProperties> servicePillar, Cluster cluster) {
ProxyConfig proxyConfig = cluster.getProxyConfig();
if (proxyConfig != null) {
Map<String, Object> proxy = new HashMap<>();
proxy.put("host", proxyConfig.getServerHost());
proxy.put("port", proxyConfig.getServerPort());
proxy.put("protocol", proxyConfig.getProtocol());
if (StringUtils.isNotBlank(proxyConfig.getUserName()) && StringUtils.isNotBlank(proxyConfig.getPassword())) {
proxy.put("user", proxyConfig.getUserName());
proxy.put("password", proxyConfig.getPassword());
}
servicePillar.put(PROXY_KEY, new SaltPillarProperties(PROXY_SLS_PATH, singletonMap(PROXY_KEY, proxy)));
}
}
use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigService method getPrivateProxyConfig.
public ProxyConfig getPrivateProxyConfig(String name, IdentityUser user) {
ProxyConfig proxyConfig = proxyConfigRepository.findByNameAndOwner(name, user.getUserId());
if (proxyConfig == null) {
throw new NotFoundException(String.format("Proxy configuration '%s' not found.", name));
}
authorizationService.hasReadPermission(proxyConfig);
return proxyConfig;
}
use of com.sequenceiq.cloudbreak.domain.ProxyConfig in project cloudbreak by hortonworks.
the class ProxyConfigService method getPublicProxyConfig.
public ProxyConfig getPublicProxyConfig(String name, IdentityUser user) {
ProxyConfig proxyConfig = proxyConfigRepository.findByNameAndAccount(name, user.getAccount());
if (proxyConfig == null) {
throw new NotFoundException(String.format("Proxy configuration '%s' not found.", name));
}
authorizationService.hasReadPermission(proxyConfig);
return proxyConfig;
}
Aggregations