com.amazonaws.auth.Signer Java Examples

The following examples show how to use com.amazonaws.auth.Signer. 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: AWSRequestSigningApacheInterceptor.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param service service that we're connecting to
 * @param signer particular signer implementation
 * @param awsCredentialsProvider source of AWS credentials for signing
 */
public AWSRequestSigningApacheInterceptor(final String service,
                                          final Signer signer,
                                          final AWSCredentialsProvider awsCredentialsProvider)
{
    this.service = service;
    this.signer = signer;
    this.awsCredentialsProvider = awsCredentialsProvider;
}
 
Example #2
Source File: AWSRequestSigningApacheInterceptor.java    From aws-request-signing-apache-interceptor with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param service service that we're connecting to
 * @param signer particular signer implementation
 * @param awsCredentialsProvider source of AWS credentials for signing
 */
public AWSRequestSigningApacheInterceptor(final String service,
                            final Signer signer,
                            final AWSCredentialsProvider awsCredentialsProvider) {
    this.service = service;
    this.signer = signer;
    this.awsCredentialsProvider = awsCredentialsProvider;
}
 
Example #3
Source File: AwsRequestSigningApacheInterceptor.java    From datacollector with Apache License 2.0 5 votes vote down vote up
/**
 *
 * @param service service that we're connecting to
 * @param signer particular signer implementation
 * @param awsCredentialsProvider source of AWS credentials for signing
 */
public AwsRequestSigningApacheInterceptor(final String service,
                                          final Signer signer,
                                          final AWSCredentialsProvider awsCredentialsProvider) {
  this.service = service;
  this.signer = signer;
  this.awsCredentialsProvider = awsCredentialsProvider;
}
 
Example #4
Source File: PrestoS3FileSystem.java    From presto with Apache License 2.0 4 votes vote down vote up
private AmazonS3 createAmazonS3Client(Configuration hadoopConfig, ClientConfiguration clientConfig)
{
    Optional<EncryptionMaterialsProvider> encryptionMaterialsProvider = createEncryptionMaterialsProvider(hadoopConfig);
    AmazonS3Builder<? extends AmazonS3Builder<?, ?>, ? extends AmazonS3> clientBuilder;

    String signerType = hadoopConfig.get(S3_SIGNER_TYPE);
    if (signerType != null) {
        clientConfig.withSignerOverride(signerType);
    }

    String signerClass = hadoopConfig.get(S3_SIGNER_CLASS);
    if (signerClass != null) {
        Class<? extends Signer> klass;
        try {
            klass = Class.forName(signerClass).asSubclass(Signer.class);
        }
        catch (ClassNotFoundException e) {
            throw new RuntimeException("Signer class not found: " + signerClass, e);
        }
        SignerFactory.registerSigner(S3_CUSTOM_SIGNER, klass);
        clientConfig.setSignerOverride(S3_CUSTOM_SIGNER);
    }

    if (encryptionMaterialsProvider.isPresent()) {
        clientBuilder = AmazonS3EncryptionClient.encryptionBuilder()
                .withCredentials(credentialsProvider)
                .withEncryptionMaterials(encryptionMaterialsProvider.get())
                .withClientConfiguration(clientConfig)
                .withMetricsCollector(METRIC_COLLECTOR);
    }
    else {
        clientBuilder = AmazonS3Client.builder()
                .withCredentials(credentialsProvider)
                .withClientConfiguration(clientConfig)
                .withMetricsCollector(METRIC_COLLECTOR);
    }

    boolean regionOrEndpointSet = false;

    // use local region when running inside of EC2
    if (pinS3ClientToCurrentRegion) {
        clientBuilder.setRegion(getCurrentRegionFromEC2Metadata().getName());
        regionOrEndpointSet = true;
    }

    String endpoint = hadoopConfig.get(S3_ENDPOINT);
    if (endpoint != null) {
        clientBuilder.setEndpointConfiguration(new EndpointConfiguration(endpoint, null));
        regionOrEndpointSet = true;
    }

    if (isPathStyleAccess) {
        clientBuilder.enablePathStyleAccess();
    }

    if (!regionOrEndpointSet) {
        clientBuilder.withRegion(US_EAST_1);
        clientBuilder.setForceGlobalBucketAccessEnabled(true);
    }

    return clientBuilder.build();
}
 
Example #5
Source File: IvonaSpeechCloudClient.java    From ivona-speechcloud-sdk-java with Apache License 2.0 4 votes vote down vote up
@Override
public Signer getSignerByURI(URI uri) {
    return this.signer;
}