Skip to content

Commit 9273c32

Browse files
committed
Merge branch 'master' into shorea-h2
2 parents 6599a3e + 41c3f18 commit 9273c32

File tree

421 files changed

+6158
-3925
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+6158
-3925
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"type": "feature",
4+
"description": "Add a standard User-Agent when making requests to the metadata service. User-Agent pattern: aws-sdk-java/<version>"
5+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"category": "AWS SDK for Java v2",
3+
"type": "feature",
4+
"description": "Split core module to regions, profiles, auth, aws-core and core modules.[#27](https://github.com/aws/aws-sdk-java-v2/issues/27)"
5+
}

auth/pom.xml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<parent>
8+
<groupId>software.amazon.awssdk</groupId>
9+
<artifactId>aws-sdk-java-pom</artifactId>
10+
<version>2.0.0-preview-10-SNAPSHOT</version>
11+
</parent>
12+
13+
<artifactId>auth</artifactId>
14+
<name>AWS Java SDK :: Auth</name>
15+
<description>
16+
The AWS SDK for Java - Auth module holds the classes that are used for authentication with AWS services
17+
</description>
18+
<url>https://aws.amazon.com/sdkforjava</url>
19+
<dependencies>
20+
<dependency>
21+
<groupId>software.amazon.awssdk</groupId>
22+
<artifactId>core</artifactId>
23+
<version>${awsjavasdk.version}</version>
24+
</dependency>
25+
<dependency>
26+
<groupId>software.amazon.awssdk</groupId>
27+
<artifactId>regions</artifactId>
28+
<version>${awsjavasdk.version}</version>
29+
</dependency>
30+
<dependency>
31+
<groupId>software.amazon.awssdk</groupId>
32+
<artifactId>profiles</artifactId>
33+
<version>${awsjavasdk.version}</version>
34+
</dependency>
35+
<dependency>
36+
<groupId>com.fasterxml.jackson.core</groupId>
37+
<artifactId>jackson-databind</artifactId>
38+
<version>${jackson.version}</version>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>junit</groupId>
43+
<artifactId>junit</artifactId>
44+
<version>${junit.version}</version>
45+
<scope>test</scope>
46+
</dependency>
47+
<dependency>
48+
<groupId>com.github.tomakehurst</groupId>
49+
<artifactId>wiremock</artifactId>
50+
<version>${wiremock.version}</version>
51+
<scope>test</scope>
52+
</dependency>
53+
<dependency>
54+
<groupId>log4j</groupId>
55+
<artifactId>log4j</artifactId>
56+
<version>${log4j.version}</version>
57+
<scope>test</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.slf4j</groupId>
61+
<artifactId>slf4j-log4j12</artifactId>
62+
<version>${slf4j.version}</version>
63+
<scope>test</scope>
64+
</dependency>
65+
<dependency>
66+
<groupId>software.amazon.awssdk</groupId>
67+
<artifactId>test-utils</artifactId>
68+
<version>${awsjavasdk.version}</version>
69+
<scope>test</scope>
70+
</dependency>
71+
<dependency>
72+
<groupId>commons-io</groupId>
73+
<artifactId>commons-io</artifactId>
74+
<scope>test</scope>
75+
</dependency>
76+
<dependency>
77+
<groupId>org.mockito</groupId>
78+
<artifactId>mockito-core</artifactId>
79+
<scope>test</scope>
80+
</dependency>
81+
<dependency>
82+
<groupId>nl.jqno.equalsverifier</groupId>
83+
<artifactId>equalsverifier</artifactId>
84+
<scope>test</scope>
85+
</dependency>
86+
<dependency>
87+
<groupId>org.unitils</groupId>
88+
<artifactId>unitils-core</artifactId>
89+
<scope>test</scope>
90+
</dependency>
91+
</dependencies>
92+
<build>
93+
<plugins>
94+
<plugin>
95+
<groupId>org.apache.maven.plugins</groupId>
96+
<artifactId>maven-compiler-plugin</artifactId>
97+
</plugin>
98+
<plugin>
99+
<groupId>org.apache.maven.plugins</groupId>
100+
<artifactId>maven-javadoc-plugin</artifactId>
101+
</plugin>
102+
<plugin>
103+
<groupId>org.codehaus.mojo</groupId>
104+
<artifactId>build-helper-maven-plugin</artifactId>
105+
</plugin>
106+
</plugins>
107+
108+
<pluginManagement>
109+
<plugins>
110+
<plugin>
111+
<groupId>org.apache.maven.plugins</groupId>
112+
<artifactId>maven-surefire-plugin</artifactId>
113+
<version>2.19.1</version>
114+
<configuration>
115+
<!-- Run multiple tests in parallel. -->
116+
<forkCount>1C</forkCount>
117+
</configuration>
118+
</plugin>
119+
</plugins>
120+
</pluginManagement>
121+
</build>
122+
</project>

core/src/it/java/software/amazon/awssdk/core/auth/InstanceProfileCredentialsProviderIntegrationTest.java renamed to auth/src/it/java/software/amazon/awssdk/auth/credentials/InstanceProfileCredentialsProviderIntegrationTest.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import static org.junit.Assert.assertEquals;
1919
import static org.junit.Assert.assertNotNull;
@@ -23,7 +23,7 @@
2323
import org.junit.Before;
2424
import org.junit.Test;
2525
import software.amazon.awssdk.core.exception.SdkClientException;
26-
import software.amazon.awssdk.core.util.LogCaptor;
26+
import software.amazon.awssdk.testutils.LogCaptor;
2727

2828
/**
2929
* Unit tests for the InstanceProfileCredentialsProvider.
@@ -69,8 +69,10 @@ public void testSessionCredentials_MultipleInstanceProfiles() throws Exception {
6969
mockServer.setResponseFileName("sessionResponse");
7070
mockServer.setAvailableSecurityCredentials("test-credentials");
7171

72-
InstanceProfileCredentialsProvider credentialsProvider = InstanceProfileCredentialsProvider.create();
73-
AwsSessionCredentials credentials = (AwsSessionCredentials) credentialsProvider.getCredentials();
72+
AwsSessionCredentials credentials;
73+
try (InstanceProfileCredentialsProvider credentialsProvider = InstanceProfileCredentialsProvider.create()) {
74+
credentials = (AwsSessionCredentials) credentialsProvider.getCredentials();
75+
}
7476

7577
assertEquals("ACCESS_KEY_ID", credentials.accessKeyId());
7678
assertEquals("SECRET_ACCESS_KEY", credentials.secretAccessKey());
@@ -86,13 +88,14 @@ public void testNoInstanceProfiles() throws Exception {
8688
mockServer.setResponseFileName("sessionResponse");
8789
mockServer.setAvailableSecurityCredentials("");
8890

89-
InstanceProfileCredentialsProvider credentialsProvider = InstanceProfileCredentialsProvider.create();
91+
try (InstanceProfileCredentialsProvider credentialsProvider = InstanceProfileCredentialsProvider.create()) {
9092

91-
try {
92-
credentialsProvider.getCredentials();
93-
fail("Expected an SdkClientException, but wasn't thrown");
94-
} catch (SdkClientException ace) {
95-
assertNotNull(ace.getMessage());
93+
try {
94+
credentialsProvider.getCredentials();
95+
fail("Expected an SdkClientException, but wasn't thrown");
96+
} catch (SdkClientException ace) {
97+
assertNotNull(ace.getMessage());
98+
}
9699
}
97100
}
98101
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* Copyright 2010-2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.auth;
17+
18+
import software.amazon.awssdk.annotations.ReviewBeforeRelease;
19+
import software.amazon.awssdk.auth.credentials.AwsCredentials;
20+
import software.amazon.awssdk.core.interceptor.ExecutionAttribute;
21+
import software.amazon.awssdk.core.interceptor.ExecutionInterceptor;
22+
import software.amazon.awssdk.core.interceptor.SdkExecutionAttributes;
23+
import software.amazon.awssdk.core.runtime.auth.Signer;
24+
import software.amazon.awssdk.regions.Region;
25+
26+
/**
27+
* AWS-specific attributes attached to the execution. This information is available to {@link ExecutionInterceptor}s and
28+
* {@link Signer}s.
29+
*/
30+
@ReviewBeforeRelease("We should also consider making some of the SDK/AWS-owned set of attributes part of the immutable context"
31+
+ "if we don't want the interceptors to modify them.")
32+
public final class AwsExecutionAttributes extends SdkExecutionAttributes {
33+
/**
34+
* The key under which the request credentials are set.
35+
*/
36+
public static final ExecutionAttribute<AwsCredentials> AWS_CREDENTIALS = new ExecutionAttribute<>("AwsCredentials");
37+
38+
/**
39+
* The AWS {@link Region} the client was configured with.
40+
*/
41+
public static final ExecutionAttribute<Region> AWS_REGION = new ExecutionAttribute<>("AwsRegion");
42+
43+
private AwsExecutionAttributes() {
44+
}
45+
}

core/src/main/java/software/amazon/awssdk/core/auth/AnonymousCredentialsProvider.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/AnonymousCredentialsProvider.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import software.amazon.awssdk.utils.ToString;
1919

core/src/main/java/software/amazon/awssdk/core/auth/AwsCredentials.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/AwsCredentials.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import static software.amazon.awssdk.utils.StringUtils.trimToNull;
1919

core/src/main/java/software/amazon/awssdk/core/auth/AwsCredentialsProvider.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/AwsCredentialsProvider.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
17+
1718

1819
/**
1920
* Interface for loading {@link AwsCredentials} that are used for authentication.

core/src/main/java/software/amazon/awssdk/core/auth/AwsCredentialsProviderChain.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/AwsCredentialsProviderChain.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import java.util.ArrayList;
1919
import java.util.Arrays;

core/src/main/java/software/amazon/awssdk/core/auth/AwsSessionCredentials.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/AwsSessionCredentials.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import java.util.Objects;
1919
import software.amazon.awssdk.utils.ToString;

core/src/main/java/software/amazon/awssdk/core/auth/CanHandleNullCredentials.java renamed to auth/src/main/java/software/amazon/awssdk/auth/credentials/CanHandleNullCredentials.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,14 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.core.auth;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import software.amazon.awssdk.core.SignableRequest;
19+
import software.amazon.awssdk.core.runtime.auth.Signer;
1920

2021
/**
2122
* Used to explicitly indicate that a {@link Signer} can gracefully handle
22-
* credentials being null when calling {@link Signer#sign(SignableRequest, AwsCredentials)}
23+
* credentials being null when calling {@link Signer#sign(SignableRequest)}
2324
*/
2425
public interface CanHandleNullCredentials {
2526
}
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,10 @@
1313
* permissions and limitations under the License.
1414
*/
1515

16-
package software.amazon.awssdk.auth.profile.internal;
16+
package software.amazon.awssdk.auth.credentials;
1717

1818
import software.amazon.awssdk.annotations.SdkProtectedApi;
19-
import software.amazon.awssdk.auth.profile.Profile;
20-
import software.amazon.awssdk.core.auth.AwsCredentialsProvider;
19+
import software.amazon.awssdk.profiles.Profile;
2120

2221
/**
2322
* A factory for {@link AwsCredentialsProvider}s that are derived from another set of credentials in a profile file.

0 commit comments

Comments
 (0)