Skip to content

Commit

Permalink
Merge branch 'main' into mds-cred-token-req-param
Browse files Browse the repository at this point in the history
  • Loading branch information
rmehta19 committed Dec 13, 2024
2 parents c96df22 + a31abff commit a625889
Show file tree
Hide file tree
Showing 12 changed files with 36 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-a.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ env_vars: {
}

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

2 changes: 1 addition & 1 deletion .kokoro/presubmit/graalvm-native-b.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ env_vars: {
}

container_properties {
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.12.0"
docker_image: "us-docker.pkg.dev/java-graalvm-ci-prod/graalvm-integration-testing/graalvm_b:1.12.2"
}
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

## [1.30.1](https://github.com/googleapis/google-auth-library-java/compare/v1.30.0...v1.30.1) (2024-12-11)


### Bug Fixes

* 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))

## [1.30.0](https://github.com/googleapis/google-auth-library-java/compare/v1.29.0...v1.30.0) (2024-11-08)


Expand Down
2 changes: 1 addition & 1 deletion appengine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-parent</artifactId>
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-bom</artifactId>
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-bom:current} -->
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-bom:current} -->
<packaging>pom</packaging>
<name>Google Auth Library for Java BOM</name>
<description>
Expand Down
2 changes: 1 addition & 1 deletion credentials/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-parent</artifactId>
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,6 @@ static GoogleAuthException createWithTokenEndpointIOException(
IOException ioException, String message) {

if (message == null) {
// TODO: temporarily setting retry Count to service account default to remove a direct
// dependency, to be reverted after release
return new GoogleAuthException(true, OAuth2Utils.DEFAULT_NUMBER_OF_RETRIES, ioException);
} else {
return new GoogleAuthException(
Expand Down
14 changes: 12 additions & 2 deletions oauth2_http/java/com/google/auth/oauth2/SecureSessionAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Map;
import java.util.ServiceLoader;
import java.util.Set;
import javax.annotation.concurrent.ThreadSafe;
Expand All @@ -59,6 +60,7 @@
*/
@ThreadSafe
public class SecureSessionAgent {
static final String S2A_JSON_KEY = "s2a";
static final String S2A_PLAINTEXT_ADDRESS_JSON_KEY = "plaintext_address";
static final String S2A_MTLS_ADDRESS_JSON_KEY = "mtls_address";
static final String S2A_CONFIG_ENDPOINT_POSTFIX =
Expand Down Expand Up @@ -188,17 +190,25 @@ private SecureSessionAgentConfig getSecureSessionAgentConfigFromMDS() {

String plaintextS2AAddress = "";
String mtlsS2AAddress = "";
Map<String, Object> s2aAddressConfig = (Map<String, Object>) responseData.get(S2A_JSON_KEY);
if (s2aAddressConfig == null) {
/*
* Return empty addresses in {@link SecureSessionAgentConfig} if endpoint doesn't return anything.
*/
return SecureSessionAgentConfig.createBuilder().build();
}
try {
plaintextS2AAddress =
OAuth2Utils.validateString(responseData, S2A_PLAINTEXT_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
OAuth2Utils.validateString(
s2aAddressConfig, S2A_PLAINTEXT_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
} catch (IOException ignore) {
/*
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.
*/
}
try {
mtlsS2AAddress =
OAuth2Utils.validateString(responseData, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
OAuth2Utils.validateString(s2aAddressConfig, S2A_MTLS_ADDRESS_JSON_KEY, PARSE_ERROR_S2A);
} catch (IOException ignore) {
/*
* Do not throw error because of parsing error, just leave the address as empty in {@link SecureSessionAgentConfig}.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,7 @@ public LowLevelHttpResponse execute() throws IOException {
GenericJson content = new GenericJson();
content.setFactory(OAuth2Utils.JSON_FACTORY);
if (requestStatusCode == 200) {
for (Map.Entry<String, String> entrySet : s2aContentMap.entrySet()) {
content.put(entrySet.getKey(), entrySet.getValue());
}
content.put(SecureSessionAgent.S2A_JSON_KEY, s2aContentMap);
}
String contentText = content.toPrettyString();

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

protected boolean isMtlsConfigRequestUrl(String url) {
return url.equals(
String.format(
ComputeEngineCredentials.getMetadataServerUrl()
+ SecureSessionAgent.S2A_CONFIG_ENDPOINT_POSTFIX));
ComputeEngineCredentials.getMetadataServerUrl()
+ SecureSessionAgent.S2A_CONFIG_ENDPOINT_POSTFIX);
}
}
2 changes: 1 addition & 1 deletion oauth2_http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<parent>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-parent</artifactId>
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-parent</artifactId>
<version>1.30.1-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<version>1.30.2-SNAPSHOT</version><!-- {x-version-update:google-auth-library-parent:current} -->
<packaging>pom</packaging>
<name>Google Auth Library for Java</name>
<description>Client libraries providing authentication and
Expand All @@ -16,7 +16,7 @@
<parent>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-shared-config</artifactId>
<version>1.12.0</version>
<version>1.12.2</version>
</parent>

<distributionManagement>
Expand Down
12 changes: 6 additions & 6 deletions versions.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Format:
# module:released-version:current-version

google-auth-library:1.30.0:1.30.1-SNAPSHOT
google-auth-library-bom:1.30.0:1.30.1-SNAPSHOT
google-auth-library-parent:1.30.0:1.30.1-SNAPSHOT
google-auth-library-appengine:1.30.0:1.30.1-SNAPSHOT
google-auth-library-credentials:1.30.0:1.30.1-SNAPSHOT
google-auth-library-oauth2-http:1.30.0:1.30.1-SNAPSHOT
google-auth-library:1.30.1:1.30.2-SNAPSHOT
google-auth-library-bom:1.30.1:1.30.2-SNAPSHOT
google-auth-library-parent:1.30.1:1.30.2-SNAPSHOT
google-auth-library-appengine:1.30.1:1.30.2-SNAPSHOT
google-auth-library-credentials:1.30.1:1.30.2-SNAPSHOT
google-auth-library-oauth2-http:1.30.1:1.30.2-SNAPSHOT

0 comments on commit a625889

Please sign in to comment.