Skip to content

Commit a625889

Browse files
committed
Merge branch 'main' into mds-cred-token-req-param
2 parents c96df22 + a31abff commit a625889

File tree

12 files changed

+36
-24
lines changed

12 files changed

+36
-24
lines changed

.kokoro/presubmit/graalvm-native-a.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@ env_vars: {
4444
}
4545

4646
container_properties {
47-
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.12.0"
47+
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_a:1.12.2"
4848
}
4949

.kokoro/presubmit/graalvm-native-b.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,5 +44,5 @@ env_vars: {
4444
}
4545

4646
container_properties {
47-
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.12.0"
47+
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.12.2"
4848
}

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# Changelog
22

3+
## [1.30.1](https://github.com/googleapis/google-auth-library-java/compare/v1.30.0...v1.30.1) (2024-12-11)
4+
5+
6+
### Bug Fixes
7+
8+
* JSON parsing of S2A addresses. ([#1589](https://github.com/googleapis/google-auth-library-java/issues/1589)) ([9d5ebfe](https://github.com/googleapis/google-auth-library-java/commit/9d5ebfe8870a11d27af3a7c7f3fd9930ab207162))
9+
310
## [1.30.0](https://github.com/googleapis/google-auth-library-java/compare/v1.29.0...v1.30.0) (2024-11-08)
411

512

appengine/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>com.google.auth</groupId>
77
<artifactId>google-auth-library-parent</artifactId>
8-
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
8+
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
99
<relativePath>../pom.xml</relativePath>
1010
</parent>
1111

bom/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<modelVersion>4.0.0</modelVersion>
44
<groupId>com.google.auth</groupId>
55
<artifactId>google-auth-library-bom</artifactId>
6-
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-bom:current} -->
6+
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-bom:current} -->
77
<packaging>pom</packaging>
88
<name>Google Auth Library for Java BOM</name>
99
<description>

credentials/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>com.google.auth</groupId>
66
<artifactId>google-auth-library-parent</artifactId>
7-
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
7+
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
88
<relativePath>../pom.xml</relativePath>
99
</parent>
1010

oauth2_http/java/com/google/auth/oauth2/GoogleAuthException.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,6 @@ static GoogleAuthException createWithTokenEndpointIOException(
156156
IOException ioException, String message) {
157157

158158
if (message == null) {
159-
// TODO: temporarily setting retry Count to service account default to remove a direct
160-
// dependency, to be reverted after release
161159
return new GoogleAuthException(true, OAuth2Utils.DEFAULT_NUMBER_OF_RETRIES, ioException);
162160
} else {
163161
return new GoogleAuthException(

oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import java.io.InputStream;
4646
import java.util.Arrays;
4747
import java.util.HashSet;
48+
import java.util.Map;
4849
import java.util.ServiceLoader;
4950
import java.util.Set;
5051
import javax.annotation.concurrent.ThreadSafe;
@@ -59,6 +60,7 @@
5960
*/
6061
@ThreadSafe
6162
public class SecureSessionAgent {
63+
static final String S2A_JSON_KEY = "s2a";
6264
static final String S2A_PLAINTEXT_ADDRESS_JSON_KEY = "plaintext_address";
6365
static final String S2A_MTLS_ADDRESS_JSON_KEY = "mtls_address";
6466
static final String S2A_CONFIG_ENDPOINT_POSTFIX =
@@ -188,17 +190,25 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() {
188190

189191
String plaintextS2AAddress = "";
190192
String mtlsS2AAddress = "";
193+
Map<String, Object> s2aAddressConfig = (Map<String, Object>) responseData.get(S2A_JSON_KEY);
194+
if (s2aAddressConfig == null) {
195+
/*
196+
* Return empty addresses in {@link SecureSessionAgentConfig} if endpoint doesn't return anything.
197+
*/
198+
return SecureSessionAgentConfig.createBuilder().build();
199+
}
191200
try {
192201
plaintextS2AAddress =
193-
OAuth2Utils.validateString(responseData, S2A_PLAINTEXT_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
202+
OAuth2Utils.validateString(
203+
s2aAddressConfig, S2A_PLAINTEXT_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
194204
} catch (IOException ignore) {
195205
/*
196206
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.
197207
*/
198208
}
199209
try {
200210
mtlsS2AAddress =
201-
OAuth2Utils.validateString(responseData, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
211+
OAuth2Utils.validateString(s2aAddressConfig, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
202212
} catch (IOException ignore) {
203213
/*
204214
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.

oauth2_http/javatests/com/google/auth/oauth2/MockMetadataServerTransport.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,7 @@ public LowLevelHttpResponse execute() throws IOException {
300300
GenericJson content = new GenericJson();
301301
content.setFactory(OAuth2Utils.JSON_FACTORY);
302302
if (requestStatusCode == 200) {
303-
for (Map.Entry<String, String> entrySet : s2aContentMap.entrySet()) {
304-
content.put(entrySet.getKey(), entrySet.getValue());
305-
}
303+
content.put(SecureSessionAgent.S2A_JSON_KEY, s2aContentMap);
306304
}
307305
String contentText = content.toPrettyString();
308306

@@ -336,8 +334,7 @@ protected boolean isIdentityDocumentUrl(String url) {
336334

337335
protected boolean isMtlsConfigRequestUrl(String url) {
338336
return url.equals(
339-
String.format(
340-
ComputeEngineCredentials.getMetadataServerUrl()
341-
+ SecureSessionAgent.S2A_CONFIG_ENDPOINT_POSTFIX));
337+
ComputeEngineCredentials.getMetadataServerUrl()
338+
+ SecureSessionAgent.S2A_CONFIG_ENDPOINT_POSTFIX);
342339
}
343340
}

oauth2_http/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<parent>
88
<groupId>com.google.auth</groupId>
99
<artifactId>google-auth-library-parent</artifactId>
10-
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
10+
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
1111
<relativePath>../pom.xml</relativePath>
1212
</parent>
1313

0 commit comments

Comments
 (0)