use of software.amazon.awssdk.auth.signer.AwsS3V4Signer in project aws-sdk-java-v2 by aws.
the class AwsS3V4SignerIntegrationTest method test_SignMethod_WithModeledParam_And_WithoutUsingSdkClient.
@Test
public void test_SignMethod_WithModeledParam_And_WithoutUsingSdkClient() throws Exception {
AwsS3V4Signer signer = AwsS3V4Signer.create();
SdkHttpFullRequest httpFullRequest = generateBasicGetRequest();
// sign the request
SdkHttpFullRequest signedRequest = signer.sign(httpFullRequest, constructSignerParams());
SdkHttpClient httpClient = ApacheHttpClient.builder().build();
HttpExecuteResponse response = httpClient.prepareRequest(HttpExecuteRequest.builder().request(signedRequest).build()).call();
assertEquals("Non success http status code", 200, response.httpResponse().statusCode());
String actualResult = IoUtils.toUtf8String(response.responseBody().get());
assertEquals(CONTENT, actualResult);
}
use of software.amazon.awssdk.auth.signer.AwsS3V4Signer in project aws-sdk-java-v2 by aws.
the class AwsS3V4SignerIntegrationTest method test_SignMethod_WithExecutionAttributes_And_WithoutUsingSdkClient.
@Test
public void test_SignMethod_WithExecutionAttributes_And_WithoutUsingSdkClient() throws Exception {
AwsS3V4Signer signer = AwsS3V4Signer.create();
SdkHttpFullRequest httpFullRequest = generateBasicGetRequest();
// sign the request
SdkHttpFullRequest signedRequest = signer.sign(httpFullRequest, constructExecutionAttributes());
SdkHttpClient httpClient = ApacheHttpClient.builder().build();
HttpExecuteResponse response = httpClient.prepareRequest(HttpExecuteRequest.builder().request(signedRequest).build()).call();
assertEquals("Non success http status code", 200, response.httpResponse().statusCode());
String actualResult = IoUtils.toUtf8String(response.responseBody().get());
assertEquals(CONTENT, actualResult);
}
use of software.amazon.awssdk.auth.signer.AwsS3V4Signer in project aws-sdk-java-v2 by aws.
the class AwsS3V4SignerIntegrationTest method testPresigning.
@Test
public void testPresigning() throws MalformedURLException {
AwsS3V4Signer signer = AwsS3V4Signer.create();
SdkHttpFullRequest httpFullRequest = generateBasicGetRequest();
SdkHttpFullRequest signedRequest = signer.presign(httpFullRequest, constructPresignerParams());
URL presignedUri = signedRequest.getUri().toURL();
assertEquals(CONTENT, getContentFromPresignedUrl(presignedUri));
}
Aggregations