Search in sources :

Example 1 with FreeIpaClientBuilder

use of com.sequenceiq.freeipa.client.FreeIpaClientBuilder in project cloudbreak by hortonworks.

the class FreeIpaClientFactory method getFreeIpaClientBuilderForClusterProxy.

private FreeIpaClientBuilder getFreeIpaClientBuilderForClusterProxy(Stack stack, Optional<String> freeIpaFqdn) throws Exception {
    HttpClientConfig httpClientConfig = new HttpClientConfig(clusterProxyConfiguration.getClusterProxyHost());
    FreeIpa freeIpa = freeIpaService.findByStack(stack);
    String clusterProxyPath = toClusterProxyBasepath(stack, freeIpaFqdn);
    Map<String, String> additionalHeadersStickySessionFirstRpc = new HashMap<>();
    Map<String, String> additionalHeadersStickySession = new HashMap<>();
    Optional<String> stickyIdHeader = Optional.empty();
    if (freeIpaFqdn.isEmpty()) {
        additionalHeadersStickySessionFirstRpc.putAll(ADDITIONAL_CLUSTER_PROXY_HEADER_STICKY_SESSION_FIRST_RPC);
        additionalHeadersStickySession.putAll(ADDITIONAL_CLUSTER_PROXY_HEADER_STICKY_SESSION);
        stickyIdHeader = Optional.of(ADDITIONAL_CLUSTER_PROXY_HEADER_STICKY_SESSION_ID);
    }
    String freeIpaFqdnForClient = freeIpaFqdn.orElseGet(() -> FreeIpaDomainUtils.getFreeIpaFqdn(freeIpa.getDomain()));
    if (useLegacyClusterProxyRegistration(stack)) {
        clusterProxyPath = toLegacyClusterProxyBasepath(stack);
    }
    return new FreeIpaClientBuilder(ADMIN_USER, freeIpa.getAdminPassword(), httpClientConfig, freeIpaFqdnForClient, clusterProxyConfiguration.getClusterProxyPort(), clusterProxyPath, ADDITIONAL_CLUSTER_PROXY_HEADERS, additionalHeadersStickySessionFirstRpc, additionalHeadersStickySession, stickyIdHeader, CLUSTER_PROXY_ERROR_LISTENER, tracer);
}
Also used : FreeIpaClientBuilder(com.sequenceiq.freeipa.client.FreeIpaClientBuilder) HttpClientConfig(com.sequenceiq.cloudbreak.client.HttpClientConfig) FreeIpa(com.sequenceiq.freeipa.entity.FreeIpa) HashMap(java.util.HashMap)

Example 2 with FreeIpaClientBuilder

use of com.sequenceiq.freeipa.client.FreeIpaClientBuilder in project cloudbreak by hortonworks.

the class FreeIpaClientFactory method getFreeIpaClientBuilderForDirectMode.

private FreeIpaClientBuilder getFreeIpaClientBuilderForDirectMode(Stack stack, InstanceMetaData instanceMetaData) throws Exception {
    HttpClientConfig httpClientConfig = tlsSecurityService.buildTLSClientConfig(stack, instanceMetaData.getPublicIpWrapper(), instanceMetaData);
    FreeIpa freeIpa = freeIpaService.findByStack(stack);
    int gatewayPort = Optional.ofNullable(stack.getGatewayport()).orElse(ServiceFamilies.GATEWAY.getDefaultPort());
    return new FreeIpaClientBuilder(ADMIN_USER, freeIpa.getAdminPassword(), httpClientConfig, gatewayPort, instanceMetaData.getDiscoveryFQDN(), tracer);
}
Also used : FreeIpaClientBuilder(com.sequenceiq.freeipa.client.FreeIpaClientBuilder) HttpClientConfig(com.sequenceiq.cloudbreak.client.HttpClientConfig) FreeIpa(com.sequenceiq.freeipa.entity.FreeIpa)

Aggregations

HttpClientConfig (com.sequenceiq.cloudbreak.client.HttpClientConfig)2 FreeIpaClientBuilder (com.sequenceiq.freeipa.client.FreeIpaClientBuilder)2 FreeIpa (com.sequenceiq.freeipa.entity.FreeIpa)2 HashMap (java.util.HashMap)1