List of usage examples for com.amazonaws ClientConfiguration ClientConfiguration
public ClientConfiguration()
From source file:io.fineo.client.auth.AWSBasicCognitoIdentityProvider.java
License:Open Source License
/** * An extension of the AbstractCognitoProvider that is used to communicate * with Cognito.// w ww .j a va2 s. co m * * @param accountId the account id of the developer * @param identityPoolId the identity pool id of the app/user in question */ public AWSBasicCognitoIdentityProvider(String accountId, String identityPoolId) { this(accountId, identityPoolId, new ClientConfiguration()); }
From source file:io.fineo.client.auth.AWSEnhancedCognitoIdentityProvider.java
License:Open Source License
/** * An extension of the AbstractCognitoProvider that is used to communicate * with Cognito./*from w w w . j a v a 2 s . c o m*/ * * @param accountId the account id of the developer * @param identityPoolId the identity pool id of the app/user in question */ public AWSEnhancedCognitoIdentityProvider(String accountId, String identityPoolId) { this(accountId, identityPoolId, new ClientConfiguration()); }
From source file:io.fineo.client.auth.cognito.CognitoUserPool.java
License:Open Source License
/** * Constructs a user-pool with default {@link ClientConfiguration}. * * @param userPoolId REQUIRED: User-pool-Id of the user-pool. * @param clientId REQUIRED: Client-Id generated for this app and user-pool at the * Cognito Identity Provider developer console. * @param clientSecret REQUIRED: Client Secret generated for this app and user-pool at * the Cognito Identity Provider developer console. *///w w w. j a v a2 s . c o m public CognitoUserPool(String userPoolId, String clientId, String clientSecret) { this.userPoolId = userPoolId; this.clientId = clientId; this.clientSecret = clientSecret; this.client = new AWSCognitoIdentityProviderClient(new AnonymousAWSCredentials(), new ClientConfiguration()); }
From source file:io.fineo.client.auth.CognitoCredentialsProvider.java
License:Open Source License
/** * Constructs a new {@link CognitoCredentialsProvider}, which will use the * specified Amazon Cognito identity pool to make a request, using the basic * authentication flow, to the AWS Security Token Service (STS) to request * short-lived session credentials, which will then be returned by this * class's {@link #getCredentials()} method. * * @param accountId The AWS accountId for the account with Amazon Cognito * @param identityPoolId The Amazon Cogntio identity pool to use * @param unauthRoleArn The ARN of the IAM Role that will be assumed when * unauthenticated/*from w ww .jav a 2 s . c o m*/ * @param authRoleArn The ARN of the IAM Role that will be assumed when * authenticated * @param region The region to use when contacting Cognito Identity */ public CognitoCredentialsProvider(String accountId, String identityPoolId, String unauthRoleArn, String authRoleArn, Regions region) { this(accountId, identityPoolId, unauthRoleArn, authRoleArn, region, new ClientConfiguration()); }
From source file:io.fineo.client.auth.CognitoCredentialsProvider.java
License:Open Source License
/** * Constructs a new {@link CognitoCredentialsProvider}, which will use the * specified Amazon Cognito identity pool to make a request to Cognito, * using the enhanced flow, to get short lived session credentials, which * will then be returned by this class's {@link #getCredentials()} method. * * @param identityPoolId The Amazon Cognito identity pool to use * @param region The region to use when contacting Cognito Identity *///from w w w. j a va 2s . c o m public CognitoCredentialsProvider(String identityPoolId, Regions region) { this(null, identityPoolId, null, null, region, new ClientConfiguration()); }
From source file:io.fineo.client.auth.CognitoCredentialsProvider.java
License:Open Source License
/** * Constructs a new CognitoCredentialsProvider, which will set up a link to * the provider passed in using the basic authentication flow to get get * short-lived credentials from STS, which can be retrieved from * {@link #getCredentials()}/*from ww w . j ava2 s.c o m*/ * <p> * This version of the constructor allows you to specify your own Identity * Provider class. * </p> * * @param provider a reference to the provider in question, including what's * needed to interact with it to later connect with STS * @param unauthArn the unauthArn, for use with the STS call * @param authArn the authArn, for use with the STS call */ public CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, String unauthArn, String authArn) { this(provider, unauthArn, authArn, new AWSSecurityTokenServiceClient(new AnonymousAWSCredentials(), new ClientConfiguration())); }
From source file:io.fineo.client.auth.CognitoCredentialsProvider.java
License:Open Source License
/** * Constructs a new CognitoCredentialsProvider, which will set up a link to * the provider passed in using the enhanced authentication flow to get * short-lived credentials from Amazon Cognito, which can be retrieved from * {@link #getCredentials()}/*from w w w .j a v a 2 s . co m*/ * <p> * This version of the constructor allows you to specify your own Identity * Provider class. * </p> * * @param provider a reference to the provider in question, including what's * needed to interact with it to later connect with Amazon * Cognito * @param region The region to use when contacting Cognito */ public CognitoCredentialsProvider(AWSCognitoIdentityProvider provider, Regions region) { this(provider, region, new ClientConfiguration()); }
From source file:io.fineo.drill.exec.store.dynamo.config.ClientProperties.java
License:Apache License
@JsonIgnore public ClientConfiguration getConfiguration() { ClientConfiguration clientConfig = new ClientConfiguration(); if (connectionTimeout > 0) { clientConfig.withClientExecutionTimeout(connectionTimeout); }/*from w ww. ja v a2 s .c om*/ if (maxConnections > 0) { clientConfig.withMaxConnections(maxConnections); } if (maxErrorRetry > 0) { clientConfig.withMaxErrorRetry(maxErrorRetry); } if (socketTimeout > 0) { clientConfig.withSocketTimeout(socketTimeout); } clientConfig.withSocketBufferSizeHints(socketSendBufferHint, socketReceiveBufferHint); if (withGzip != null) { clientConfig.setUseGzip(withGzip.booleanValue()); } if (withReaper != null) { clientConfig.setUseReaper(withReaper.booleanValue()); } return clientConfig; }
From source file:io.konig.camel.component.aws.s3.client.impl.S3ClientIAMOptimizedImpl.java
License:Apache License
/** * Getting the s3 aws client that is used. * @return Amazon S3 Client.//from w ww. j a v a2 s. c om */ public AmazonS3 getS3Client() { AmazonS3 client = null; AmazonS3ClientBuilder clientBuilder = null; AmazonS3EncryptionClientBuilder encClientBuilder = null; ClientConfiguration clientConfiguration = null; if (configuration.hasProxyConfiguration()) { clientConfiguration = new ClientConfiguration(); clientConfiguration.setProxyHost(configuration.getProxyHost()); clientConfiguration.setProxyPort(configuration.getProxyPort()); clientConfiguration.setMaxConnections(maxConnections); } else { clientConfiguration = new ClientConfiguration(); clientConfiguration.setMaxConnections(maxConnections); } if (configuration.getAccessKey() != null || configuration.getSecretKey() != null) { LOG.trace("Do not pass in unnecessary static credentials when selecting the IAM credential option."); } if (!configuration.isUseEncryption()) { clientBuilder = AmazonS3ClientBuilder.standard() .withCredentials(new InstanceProfileCredentialsProvider(false)); } else if (configuration.isUseEncryption()) { StaticEncryptionMaterialsProvider encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider( configuration.getEncryptionMaterials()); encClientBuilder = AmazonS3EncryptionClientBuilder.standard() .withClientConfiguration(clientConfiguration) .withEncryptionMaterials(encryptionMaterialsProvider) .withCredentials(new InstanceProfileCredentialsProvider(false)); } else { clientBuilder = AmazonS3ClientBuilder.standard().withClientConfiguration(clientConfiguration) .withCredentials(new InstanceProfileCredentialsProvider(false)); } if (!configuration.isUseEncryption()) { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = clientBuilder.build(); } else { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = encClientBuilder.build(); } return client; }
From source file:io.konig.camel.component.aws.s3.client.impl.S3ClientStandardImpl.java
License:Apache License
/** * Getting the s3 aws client that is used. * @return Amazon S3 Client.//from www. ja va 2 s .c o m */ public AmazonS3 getS3Client() { AmazonS3 client = null; AmazonS3ClientBuilder clientBuilder = null; AmazonS3EncryptionClientBuilder encClientBuilder = null; ClientConfiguration clientConfiguration = null; if (configuration.hasProxyConfiguration()) { clientConfiguration = new ClientConfiguration(); clientConfiguration.setProxyHost(configuration.getProxyHost()); clientConfiguration.setProxyPort(configuration.getProxyPort()); clientConfiguration.setMaxConnections(maxConnections); } else { clientConfiguration = new ClientConfiguration(); clientConfiguration.setMaxConnections(maxConnections); } if (configuration.getAccessKey() != null && configuration.getSecretKey() != null) { AWSCredentials credentials = new BasicAWSCredentials(configuration.getAccessKey(), configuration.getSecretKey()); AWSCredentialsProvider credentialsProvider = new AWSStaticCredentialsProvider(credentials); if (!configuration.isUseEncryption()) { clientBuilder = AmazonS3ClientBuilder.standard().withClientConfiguration(clientConfiguration) .withCredentials(credentialsProvider); } else if (configuration.isUseEncryption()) { StaticEncryptionMaterialsProvider encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider( configuration.getEncryptionMaterials()); encClientBuilder = AmazonS3EncryptionClientBuilder.standard() .withClientConfiguration(clientConfiguration).withCredentials(credentialsProvider) .withEncryptionMaterials(encryptionMaterialsProvider); } else { clientBuilder = AmazonS3ClientBuilder.standard().withCredentials(credentialsProvider); } if (!configuration.isUseEncryption()) { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = clientBuilder.build(); } else { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = encClientBuilder.build(); } } else { if (!configuration.isUseEncryption()) { clientBuilder = AmazonS3ClientBuilder.standard(); } else if (configuration.isUseEncryption()) { StaticEncryptionMaterialsProvider encryptionMaterialsProvider = new StaticEncryptionMaterialsProvider( configuration.getEncryptionMaterials()); encClientBuilder = AmazonS3EncryptionClientBuilder.standard() .withClientConfiguration(clientConfiguration) .withEncryptionMaterials(encryptionMaterialsProvider); } else { clientBuilder = AmazonS3ClientBuilder.standard().withClientConfiguration(clientConfiguration); } if (!configuration.isUseEncryption()) { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { clientBuilder = clientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } clientBuilder = clientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = clientBuilder.build(); } else { if (ObjectHelper.isNotEmpty(configuration.getRegion())) { encClientBuilder = encClientBuilder.withRegion(Regions.valueOf(configuration.getRegion())); } encClientBuilder = encClientBuilder.withPathStyleAccessEnabled(configuration.isPathStyleAccess()); client = encClientBuilder.build(); } } return client; }