Java Code Examples for com.amazonaws.ClientConfiguration#setProxyHost()

The following examples show how to use com.amazonaws.ClientConfiguration#setProxyHost() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AWSClients.java    From aws-codedeploy-plugin with Apache License 2.0 6 votes vote down vote up
public AWSClients(String region, AWSCredentials credentials, String proxyHost, int proxyPort) {
    this.region = region;
    this.proxyHost = proxyHost;
    this.proxyPort = proxyPort;

    //setup proxy connection:
    ClientConfiguration clientCfg = new ClientConfiguration();
    if (proxyHost != null && proxyPort > 0 ) {
        clientCfg.setProxyHost(proxyHost);
        clientCfg.setProxyPort(proxyPort);
    }

    this.s3 = credentials != null ? new AmazonS3Client(credentials, clientCfg) : new AmazonS3Client(clientCfg);
    this.codedeploy = credentials != null ? new AmazonCodeDeployClient(credentials, clientCfg) : new AmazonCodeDeployClient(clientCfg);
    codedeploy.setRegion(Region.getRegion(Regions.fromName(this.region)));
    s3.setRegion(Region.getRegion(Regions.fromName(this.region)));
}
 
Example 2
Source File: S3Accessor.java    From datacollector with Apache License 2.0 6 votes vote down vote up
ClientConfiguration createClientConfiguration() throws StageException {
  ClientConfiguration clientConfig = new ClientConfiguration();

  clientConfig.setConnectionTimeout(connectionConfigs.getConnectionTimeoutMillis());
  clientConfig.setSocketTimeout(connectionConfigs.getSocketTimeoutMillis());
  clientConfig.withMaxErrorRetry(connectionConfigs.getMaxErrorRetry());

  if (connectionConfigs.isProxyEnabled()) {
    clientConfig.setProxyHost(connectionConfigs.getProxyHost());
    clientConfig.setProxyPort(connectionConfigs.getProxyPort());
    if (connectionConfigs.isProxyAuthenticationEnabled()) {
      clientConfig.setProxyUsername(connectionConfigs.getProxyUser().get());
      clientConfig.setProxyPassword(connectionConfigs.getProxyPassword().get());
    }
  }
  return clientConfig;
}
 
Example 3
Source File: S3Service.java    From crate with Apache License 2.0 6 votes vote down vote up
static ClientConfiguration buildConfiguration(S3ClientSettings clientSettings) {
    final ClientConfiguration clientConfiguration = new ClientConfiguration();
    // the response metadata cache is only there for diagnostics purposes,
    // but can force objects from every response to the old generation.
    clientConfiguration.setResponseMetadataCacheSize(0);
    clientConfiguration.setProtocol(clientSettings.protocol);

    if (Strings.hasText(clientSettings.proxyHost)) {
        // TODO: remove this leniency, these settings should exist together and be validated
        clientConfiguration.setProxyHost(clientSettings.proxyHost);
        clientConfiguration.setProxyPort(clientSettings.proxyPort);
        clientConfiguration.setProxyUsername(clientSettings.proxyUsername);
        clientConfiguration.setProxyPassword(clientSettings.proxyPassword);
    }

    clientConfiguration.setMaxErrorRetry(clientSettings.maxRetries);
    clientConfiguration.setUseThrottleRetries(clientSettings.throttleRetries);
    clientConfiguration.setSocketTimeout(clientSettings.readTimeoutMillis);

    return clientConfiguration;
}
 
Example 4
Source File: AWSUtil.java    From datacollector with Apache License 2.0 6 votes vote down vote up
public static ClientConfiguration getClientConfiguration(ProxyConfig config) throws StageException {
  ClientConfiguration clientConfig = new ClientConfiguration();

  clientConfig.setConnectionTimeout(config.connectionTimeout * MILLIS);
  clientConfig.setSocketTimeout(config.socketTimeout * MILLIS);
  clientConfig.withMaxErrorRetry(config.retryCount);

  // Optional proxy settings
  if (config.useProxy) {
    if (config.proxyHost != null && !config.proxyHost.isEmpty()) {
      clientConfig.setProxyHost(config.proxyHost);
      clientConfig.setProxyPort(config.proxyPort);

      if (config.proxyUser != null && !config.proxyUser.get().isEmpty()) {
        clientConfig.setProxyUsername(config.proxyUser.get());
      }

      if (config.proxyPassword != null) {
        clientConfig.setProxyPassword(config.proxyPassword.get());
      }
    }
  }
  return clientConfig;
}
 
Example 5
Source File: AwsS3Test.java    From ecs-sync with Apache License 2.0 6 votes vote down vote up
@Before
public void setup() throws Exception {
    Properties syncProperties = TestConfig.getProperties();
    endpoint = syncProperties.getProperty(TestConfig.PROP_S3_ENDPOINT);
    accessKey = syncProperties.getProperty(TestConfig.PROP_S3_ACCESS_KEY_ID);
    secretKey = syncProperties.getProperty(TestConfig.PROP_S3_SECRET_KEY);
    region = syncProperties.getProperty(TestConfig.PROP_S3_REGION);
    String proxyUri = syncProperties.getProperty(TestConfig.PROP_HTTP_PROXY_URI);
    Assume.assumeNotNull(endpoint, accessKey, secretKey);
    endpointUri = new URI(endpoint);

    ClientConfiguration config = new ClientConfiguration().withSignerOverride("S3SignerType");
    if (proxyUri != null) {
        URI uri = new URI(proxyUri);
        config.setProxyHost(uri.getHost());
        config.setProxyPort(uri.getPort());
    }

    AmazonS3ClientBuilder builder = AmazonS3ClientBuilder.standard()
            .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKey, secretKey)))
            .withClientConfiguration(config)
            .withEndpointConfiguration(new AwsClientBuilder.EndpointConfiguration(endpoint, region));

    s3 = builder.build();
}
 
Example 6
Source File: AWSClientFactory.java    From awseb-deployment-plugin with Apache License 2.0 6 votes vote down vote up
private static AWSClientFactory getClientFactory(AWSCredentialsProvider provider,
                                                 String awsRegion) {
    ClientConfiguration clientConfig = new ClientConfiguration();

    Jenkins jenkins = Jenkins.get();

    if (jenkins.proxy != null) {
        ProxyConfiguration proxyConfig = jenkins.proxy;
        clientConfig.setProxyHost(proxyConfig.name);
        clientConfig.setProxyPort(proxyConfig.port);
        if (proxyConfig.getUserName() != null) {
            clientConfig.setProxyUsername(proxyConfig.getUserName());
            clientConfig.setProxyPassword(proxyConfig.getPassword());
        }
    }

    clientConfig.setUserAgentPrefix("ingenieux CloudButler/" + Utils.getVersion());

    return new AWSClientFactory(provider, clientConfig, awsRegion);
}
 
Example 7
Source File: AwsModuleTest.java    From beam with Apache License 2.0 6 votes vote down vote up
@Test
public void testClientConfigurationSerializationDeserialization() throws Exception {
  ClientConfiguration clientConfiguration = new ClientConfiguration();
  clientConfiguration.setProxyHost("localhost");
  clientConfiguration.setProxyPort(1234);
  clientConfiguration.setProxyUsername("username");
  clientConfiguration.setProxyPassword("password");

  final String valueAsJson = objectMapper.writeValueAsString(clientConfiguration);
  final ClientConfiguration valueDes =
      objectMapper.readValue(valueAsJson, ClientConfiguration.class);
  assertEquals("localhost", valueDes.getProxyHost());
  assertEquals(1234, valueDes.getProxyPort());
  assertEquals("username", valueDes.getProxyUsername());
  assertEquals("password", valueDes.getProxyPassword());
}
 
Example 8
Source File: PropertyBasedS3ClientConfig.java    From exhibitor with Apache License 2.0 6 votes vote down vote up
@Override
public ClientConfiguration getAWSClientConfig()
{
    ClientConfiguration awsClientConfig = new ClientConfiguration();
    awsClientConfig.setProxyHost(proxyHost);
    awsClientConfig.setProxyPort(proxyPort);

    if ( proxyUsername != null )
    {
        awsClientConfig.setProxyUsername(proxyUsername);
    }

    if ( proxyPassword != null )
    {
        awsClientConfig.setProxyPassword(proxyPassword);
    }
    return awsClientConfig;
}
 
Example 9
Source File: ServiceSpringModuleConfig.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Gets a JMS connection factory.
 *
 * @return the JMS connection factory.
 */
@Bean
public ConnectionFactory jmsConnectionFactory()
{
    AwsParamsDto awsParamsDto = awsHelper.getAwsParamsDto();

    ClientConfiguration clientConfiguration = new ClientConfiguration();

    // Only set the proxy hostname and/or port if they're configured.
    if (StringUtils.isNotBlank(awsParamsDto.getHttpProxyHost()))
    {
        clientConfiguration.setProxyHost(awsParamsDto.getHttpProxyHost());
    }
    if (awsParamsDto.getHttpProxyPort() != null)
    {
        clientConfiguration.setProxyPort(awsParamsDto.getHttpProxyPort());
    }

    return SQSConnectionFactory.builder().withClientConfiguration(clientConfiguration).build();
}
 
Example 10
Source File: StsDaoImpl.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Returns a set of temporary security credentials (consisting of an access key ID, a secret access key, and a security token) that can be used to access
 * the specified AWS resource.
 *
 * @param sessionName the session name that will be associated with the temporary credentials. The session name must be the same for an initial set of
 * credentials and an extended set of credentials if credentials are to be refreshed. The session name also is used to identify the user in AWS logs so it
 * should be something unique and useful to identify the caller/use.
 * @param awsRoleArn the AWS ARN for the role required to provide access to the specified AWS resource
 * @param awsRoleDurationSeconds the duration, in seconds, of the role session. The value can range from 900 seconds (15 minutes) to 3600 seconds (1 hour).
 * @param policy the temporary policy to apply to this request
 *
 * @return the assumed session credentials
 */
@Override
public Credentials getTemporarySecurityCredentials(AwsParamsDto awsParamsDto, String sessionName, String awsRoleArn, int awsRoleDurationSeconds,
    Policy policy)
{
    // Construct a new AWS security token service client using the specified client configuration to access Amazon S3.
    // A credentials provider chain will be used that searches for credentials in this order:
    // - Environment Variables - AWS_ACCESS_KEY_ID and AWS_SECRET_KEY
    // - Java System Properties - aws.accessKeyId and aws.secretKey
    // - Instance Profile Credentials - delivered through the Amazon EC2 metadata service

    ClientConfiguration clientConfiguration = new ClientConfiguration().withRetryPolicy(retryPolicyFactory.getRetryPolicy());

    // Only set the proxy hostname and/or port if they're configured.
    if (StringUtils.isNotBlank(awsParamsDto.getHttpProxyHost()))
    {
        clientConfiguration.setProxyHost(awsParamsDto.getHttpProxyHost());
    }
    if (awsParamsDto.getHttpProxyPort() != null)
    {
        clientConfiguration.setProxyPort(awsParamsDto.getHttpProxyPort());
    }

    AWSSecurityTokenServiceClient awsSecurityTokenServiceClient = new AWSSecurityTokenServiceClient(clientConfiguration);

    // Create the request.
    AssumeRoleRequest assumeRoleRequest = new AssumeRoleRequest();
    assumeRoleRequest.setRoleSessionName(sessionName);
    assumeRoleRequest.setRoleArn(awsRoleArn);
    assumeRoleRequest.setDurationSeconds(awsRoleDurationSeconds);
    if (policy != null)
    {
        assumeRoleRequest.setPolicy(policy.toJson());
    }

    // Get the temporary security credentials.
    AssumeRoleResult assumeRoleResult = stsOperations.assumeRole(awsSecurityTokenServiceClient, assumeRoleRequest);
    return assumeRoleResult.getCredentials();
}
 
Example 11
Source File: LambdaClientConfig.java    From aws-lambda-jenkins-plugin with MIT License 6 votes vote down vote up
private ClientConfiguration getClientConfiguration() {
    /*
    Jenkins instance = Jenkins.getInstance();

    if (instance != null) {
        ProxyConfiguration proxy = instance.proxy;
    */
    ClientConfiguration config = new ClientConfiguration();

    if (proxyConfiguration != null) {
        config.setProxyHost(proxyConfiguration.name);
        config.setProxyPort(proxyConfiguration.port);
        if (proxyConfiguration.getUserName() != null) {
            config.setProxyUsername(proxyConfiguration.getUserName());
            config.setProxyPassword(proxyConfiguration.getPassword());
        }
        if (proxyConfiguration.noProxyHost != null) {
            config.setNonProxyHosts(proxyConfiguration.noProxyHost);
        }
    }

    return config;

}
 
Example 12
Source File: EC2Communication.java    From development with Apache License 2.0 5 votes vote down vote up
/**
 * Return amazon interface
 * 
 * @return AmazonEC2 client ec2
 */

AmazonEC2 getEC2() {
    if (ec2 == null) {
        String endpoint = ENDPOINT_PREFIX + ph.getRegion()
                + ENDPOINT_SUFFIX;
        String proxyHost = System.getProperty(HTTPS_PROXY_HOST);
        String proxyPort = System.getProperty(HTTPS_PROXY_PORT);
        String proxyUser = System.getProperty(HTTPS_PROXY_USER);
        String proxyPassword = System.getProperty(HTTPS_PROXY_PASSWORD);

        int proxyPortInt = 0;
        try {
            proxyPortInt = Integer.parseInt(proxyPort);
        } catch (NumberFormatException e) {
            // ignore
        }
        ClientConfiguration clientConfiguration = new ClientConfiguration();
        if (!isNonProxySet(endpoint)) {
            if (proxyHost != null) {
                clientConfiguration.setProxyHost(proxyHost);
            }
            if (proxyPortInt > 0) {
                clientConfiguration.setProxyPort(proxyPortInt);
            }
            if (proxyUser != null && proxyUser.length() > 0) {
                clientConfiguration.setProxyUsername(proxyUser);
            }
            if (proxyPassword != null && proxyPassword.length() > 0) {
                clientConfiguration.setProxyPassword(proxyPassword);
            }
        }
        ec2 = getEC2(credentialsProvider, clientConfiguration);
        ec2.setEndpoint(endpoint);
    }
    return ec2;
}
 
Example 13
Source File: AwsClientConfiguration.java    From s3-cf-service-broker with Apache License 2.0 5 votes vote down vote up
public ClientConfiguration toClientConfiguration(){
    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setProxyHost(proxyHost);
    if(proxyPort != null) {
        clientConfiguration.setProxyPort(Integer.parseInt(proxyPort));
    }
    clientConfiguration.setProxyUsername(proxyUsername);
    clientConfiguration.setProxyPassword(proxyPassword);
    if(preemptiveBasicProxyAuth != null) {
        clientConfiguration.setPreemptiveBasicProxyAuth(preemptiveBasicProxyAuth);
    }
    return clientConfiguration;
}
 
Example 14
Source File: KinesisAppender.java    From kinesis-log4j-appender with Apache License 2.0 5 votes vote down vote up
/**
 * Set proxy configuration based on system properties. Some of the properties are standard
 * properties documented by Oracle (http.proxyHost, http.proxyPort, http.auth.ntlm.domain),
 * and others are from common convention (http.proxyUser, http.proxyPassword).
 *
 * Finally, for NTLM authentication the workstation name is taken from the environment as
 * COMPUTERNAME. We set this on the client configuration only if the NTLM domain was specified.
 */
private ClientConfiguration setProxySettingsFromSystemProperties(ClientConfiguration clientConfiguration) {

    final String proxyHost = System.getProperty("http.proxyHost");
    if(proxyHost != null) {
        clientConfiguration.setProxyHost(proxyHost);
    }

    final String proxyPort = System.getProperty("http.proxyPort");
    if(proxyPort != null) {
        clientConfiguration.setProxyPort(Integer.parseInt(proxyPort));
    }

    final String proxyUser = System.getProperty("http.proxyUser");
    if(proxyUser != null) {
        clientConfiguration.setProxyUsername(proxyUser);
    }

    final String proxyPassword = System.getProperty("http.proxyPassword");
    if(proxyPassword != null) {
        clientConfiguration.setProxyPassword(proxyPassword);
    }

    final String proxyDomain = System.getProperty("http.auth.ntlm.domain");
    if(proxyDomain != null) {
        clientConfiguration.setProxyDomain(proxyDomain);
    }

    final String workstation = System.getenv("COMPUTERNAME");
    if(proxyDomain != null && workstation != null) {
        clientConfiguration.setProxyWorkstation(workstation);
    }

    return clientConfiguration;
}
 
Example 15
Source File: Aws.java    From digdag with Apache License 2.0 5 votes vote down vote up
static void configureProxy(ClientConfiguration configuration, ProxyConfig proxyConfig)
{
    configuration.setProxyHost(proxyConfig.getHost());
    configuration.setProxyPort(proxyConfig.getPort());
    Optional<String> user = proxyConfig.getUser();
    if (user.isPresent()) {
        configuration.setProxyUsername(user.get());
    }
    Optional<String> password = proxyConfig.getPassword();
    if (password.isPresent()) {
        configuration.setProxyPassword(password.get());
    }
}
 
Example 16
Source File: InvocationClientConfig.java    From kafka-connect-lambda with Apache License 2.0 5 votes vote down vote up
ClientConfiguration loadAwsClientConfiguration() {
    ClientConfiguration clientConfiguration = new ClientConfiguration();

    String httpProxyHost = this.getString(HTTP_PROXY_HOST_KEY);
    if (httpProxyHost != null && !httpProxyHost.isEmpty()) {
        clientConfiguration.setProxyHost(httpProxyHost);

        Integer httpProxyPort = this.getInt(HTTP_PROXY_PORT_KEY);
        if (httpProxyPort > 0)
            clientConfiguration.setProxyPort(httpProxyPort);
    }

    return clientConfiguration;
}
 
Example 17
Source File: AWSClients.java    From aws-codedeploy-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Via the default provider chain (i.e., global keys for this Jenkins instance),  return the account ID for the
 * currently authenticated user.
 * @param proxyHost hostname of the proxy to use (if any)
 * @param proxyPort port of the proxy to use (if any)
 * @return 12-digit account id
 */
public static String getAccountId(String proxyHost, int proxyPort) {

    String arn = "";
    try {
        ClientConfiguration clientCfg = new ClientConfiguration();
        if (proxyHost != null && proxyPort > 0 ) {
            clientCfg.setProxyHost(proxyHost);
            clientCfg.setProxyPort(proxyPort);
        }
        AmazonIdentityManagementClient iam = new AmazonIdentityManagementClient(clientCfg);
        GetUserResult user = iam.getUser();
        arn = user.getUser().getArn();
    } catch (AmazonServiceException e) {
        if (e.getErrorCode().compareTo("AccessDenied") == 0) {
            String msg = e.getMessage();
            int arnIdx = msg.indexOf("arn:aws");
            if (arnIdx != -1) {
                int arnSpace = msg.indexOf(" ", arnIdx);
                arn = msg.substring(arnIdx, arnSpace);
            }
        }
    }

    String accountId = arn.split(":")[ARN_ACCOUNT_ID_INDEX];
    return accountId;
}
 
Example 18
Source File: ServiceCatalogClientBuilder.java    From cs-actions with Apache License 2.0 5 votes vote down vote up
public static AWSServiceCatalog getServiceCatalogClientBuilder(
        String accessKeyId,
        String secretAccessKey,
        String proxyHost,
        Integer proxyPort,
        String proxyUsername,
        String proxyPassword,
        Integer connectTimeoutMs,
        Integer executionTimeoutMs,
        String region,
        boolean async) {

    ClientConfiguration clientConfiguration = new ClientConfiguration();
    clientConfiguration.setConnectionTimeout(connectTimeoutMs);
    clientConfiguration.setClientExecutionTimeout(executionTimeoutMs);

    if (!StringUtils.isEmpty(proxyHost)) {
        clientConfiguration.setProxyHost(proxyHost);
        clientConfiguration.setProxyPort(proxyPort);
        if (!StringUtils.isEmpty(proxyUsername)) {
            clientConfiguration.setProxyUsername(proxyUsername);
            clientConfiguration.setProxyPassword(proxyPassword);
        }
    }
    if (!async) {
        return AWSServiceCatalogClientBuilder.standard()
                .withRegion(region)
                .withClientConfiguration(clientConfiguration)
                .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretAccessKey)))
                .build();
    }
    return AWSServiceCatalogAsyncClientBuilder.standard()
            .withRegion(region)
            .withClientConfiguration(clientConfiguration)
            .withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(accessKeyId, secretAccessKey)))
            .build();


}
 
Example 19
Source File: AbstractAWSProcessor.java    From localization_nifi with Apache License 2.0 5 votes vote down vote up
protected ClientConfiguration createConfiguration(final ProcessContext context) {
    final ClientConfiguration config = new ClientConfiguration();
    config.setMaxConnections(context.getMaxConcurrentTasks());
    config.setMaxErrorRetry(0);
    config.setUserAgent(DEFAULT_USER_AGENT);
    // If this is changed to be a property, ensure other uses are also changed
    config.setProtocol(DEFAULT_PROTOCOL);
    final int commsTimeout = context.getProperty(TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
    config.setConnectionTimeout(commsTimeout);
    config.setSocketTimeout(commsTimeout);

    final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
    if (sslContextService != null) {
        final SSLContext sslContext = sslContextService.createSSLContext(SSLContextService.ClientAuth.NONE);
        SdkTLSSocketFactory sdkTLSSocketFactory = new SdkTLSSocketFactory(sslContext, null);
        config.getApacheHttpClientConfig().setSslSocketFactory(sdkTLSSocketFactory);
    }

    if (context.getProperty(PROXY_HOST).isSet()) {
        String proxyHost = context.getProperty(PROXY_HOST).getValue();
        config.setProxyHost(proxyHost);
        Integer proxyPort = context.getProperty(PROXY_HOST_PORT).asInteger();
        config.setProxyPort(proxyPort);
    }

    return config;
}
 
Example 20
Source File: AbstractAWSProcessor.java    From nifi with Apache License 2.0 4 votes vote down vote up
protected ClientConfiguration createConfiguration(final ProcessContext context) {
    final ClientConfiguration config = new ClientConfiguration();
    config.setMaxConnections(context.getMaxConcurrentTasks());
    config.setMaxErrorRetry(0);
    config.setUserAgent(DEFAULT_USER_AGENT);
    // If this is changed to be a property, ensure other uses are also changed
    config.setProtocol(DEFAULT_PROTOCOL);
    final int commsTimeout = context.getProperty(TIMEOUT).asTimePeriod(TimeUnit.MILLISECONDS).intValue();
    config.setConnectionTimeout(commsTimeout);
    config.setSocketTimeout(commsTimeout);

    if(this.getSupportedPropertyDescriptors().contains(SSL_CONTEXT_SERVICE)) {
        final SSLContextService sslContextService = context.getProperty(SSL_CONTEXT_SERVICE).asControllerService(SSLContextService.class);
        if (sslContextService != null) {
            final SSLContext sslContext = sslContextService.createSSLContext(SslContextFactory.ClientAuth.NONE);
            // NIFI-3788: Changed hostnameVerifier from null to DHV (BrowserCompatibleHostnameVerifier is deprecated)
            SdkTLSSocketFactory sdkTLSSocketFactory = new SdkTLSSocketFactory(sslContext, new DefaultHostnameVerifier());
            config.getApacheHttpClientConfig().setSslSocketFactory(sdkTLSSocketFactory);
        }
    }

    final ProxyConfiguration proxyConfig = ProxyConfiguration.getConfiguration(context, () -> {
        if (context.getProperty(PROXY_HOST).isSet()) {
            final ProxyConfiguration componentProxyConfig = new ProxyConfiguration();
            String proxyHost = context.getProperty(PROXY_HOST).evaluateAttributeExpressions().getValue();
            Integer proxyPort = context.getProperty(PROXY_HOST_PORT).evaluateAttributeExpressions().asInteger();
            String proxyUsername = context.getProperty(PROXY_USERNAME).evaluateAttributeExpressions().getValue();
            String proxyPassword = context.getProperty(PROXY_PASSWORD).evaluateAttributeExpressions().getValue();
            componentProxyConfig.setProxyType(Proxy.Type.HTTP);
            componentProxyConfig.setProxyServerHost(proxyHost);
            componentProxyConfig.setProxyServerPort(proxyPort);
            componentProxyConfig.setProxyUserName(proxyUsername);
            componentProxyConfig.setProxyUserPassword(proxyPassword);
            return componentProxyConfig;
        }
        return ProxyConfiguration.DIRECT_CONFIGURATION;
    });

    if (Proxy.Type.HTTP.equals(proxyConfig.getProxyType())) {
        config.setProxyHost(proxyConfig.getProxyServerHost());
        config.setProxyPort(proxyConfig.getProxyServerPort());

        if (proxyConfig.hasCredential()) {
            config.setProxyUsername(proxyConfig.getProxyUserName());
            config.setProxyPassword(proxyConfig.getProxyUserPassword());
        }
    }

    return config;
}