diff --git a/.kokoro/release/publish_javadoc.cfg b/.kokoro/release/publish_javadoc.cfg
new file mode 100644
index 000000000..41fae5e12
--- /dev/null
+++ b/.kokoro/release/publish_javadoc.cfg
@@ -0,0 +1,16 @@
+# Format: //devtools/kokoro/config/proto/build.proto
+
+env_vars: {
+ key: "TRAMPOLINE_BUILD_FILE"
+ value: "github/google-auth-library-java/.kokoro/release/publish_javadoc.sh"
+}
+
+env_vars: {
+ key: "LINK_LATEST"
+ value: "true"
+}
+
+env_vars: {
+ key: "BUCKET"
+ value: "gcloud-javadoc-testing"
+}
diff --git a/.kokoro/release/publish_javadoc.sh b/.kokoro/release/publish_javadoc.sh
new file mode 100755
index 000000000..cfdc9dabc
--- /dev/null
+++ b/.kokoro/release/publish_javadoc.sh
@@ -0,0 +1,65 @@
+#!/bin/bash
+# Copyright 2018, Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#
+# * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+set -e
+
+if [[ -z "${BUCKET}" ]]; then
+ echo "Must set BUCKET environment variable"
+ exit 1
+fi
+
+pushd $(dirname "$0")/../../
+
+# Pull the library version from project properties
+VERSION=$(mvn org.apache.maven.plugins:maven-help-plugin:2.1.1:evaluate -Dexpression=project.version | grep -Ev '(^\[|\w+:)')
+
+case "${VERSION}" in
+ *-SNAPSHOT)
+ echo "Cannot publish javadoc for -SNAPSHOT versions"
+ exit 1
+ ;;
+ "")
+ echo "Could not obtain version number from maven-help-plugin."
+ exit 1
+ ;;
+esac
+
+# Generate the javadoc from scratch
+mvn clean install javadoc:aggregate -DskipTests=true -B
+
+# Sync the current version to gCS
+gsutil -m rsync -d target/site gs://${BUCKET}/java/google-auth-library-java/${VERSION}
+
+if [[ "${LINK_LATEST}" == "true" ]]; then
+ # Sync the current content to latest
+ gsutil -m rsync gs://${BUCKET}/java/google-auth-library-java/${VERSION} gs://${BUCKET}/java/google-auth-library-java/latest
+fi
+
+popd
diff --git a/.kokoro/release/stage.cfg b/.kokoro/release/stage.cfg
index 8836efa5a..811bf3b68 100644
--- a/.kokoro/release/stage.cfg
+++ b/.kokoro/release/stage.cfg
@@ -12,3 +12,13 @@ action {
strip_prefix: "github/google-auth-library-java"
}
}
+
+# Fetch the token needed for reporting release status to GitHub
+before_action {
+ fetch_keystore {
+ keystore_resource {
+ keystore_config_id: 73713
+ keyname: "yoshi-automation-github-key"
+ }
+ }
+}
diff --git a/.kokoro/release/stage.sh b/.kokoro/release/stage.sh
index 11cbc3fcf..5de13f234 100755
--- a/.kokoro/release/stage.sh
+++ b/.kokoro/release/stage.sh
@@ -15,6 +15,10 @@
set -eo pipefail
+# Start the releasetool reporter
+python3 -m pip install gcp-releasetool
+python3 -m releasetool publish-reporter-script > /tmp/publisher-script; source /tmp/publisher-script
+
source $(dirname "$0")/common.sh
MAVEN_SETTINGS_FILE=$(realpath $(dirname "$0")/../../)/settings.xml
pushd $(dirname "$0")/../../
diff --git a/README.md b/README.md
index 23624ea75..e9b51cc9d 100644
--- a/README.md
+++ b/README.md
@@ -34,7 +34,7 @@ If you are using Maven, add this to your pom.xml file (notice that you can repla
com.google.auth
google-auth-library-oauth2-http
- 0.12.0
+ 0.13.0
```
[//]: # ({x-version-update-end})
@@ -44,7 +44,7 @@ If you are using Gradle, add this to your dependencies
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
```Groovy
-compile 'com.google.auth:google-auth-library-oauth2-http:0.12.0'
+compile 'com.google.auth:google-auth-library-oauth2-http:0.13.0'
```
[//]: # ({x-version-update-end})
@@ -52,7 +52,7 @@ If you are using SBT, add this to your dependencies
[//]: # ({x-version-update-start:google-auth-library-oauth2-http:released})
```Scala
-libraryDependencies += "com.google.auth" % "google-auth-library-oauth2-http" % "0.12.0"
+libraryDependencies += "com.google.auth" % "google-auth-library-oauth2-http" % "0.13.0"
```
[//]: # ({x-version-update-end})
diff --git a/appengine/pom.xml b/appengine/pom.xml
index f6913048f..c0ef92b98 100644
--- a/appengine/pom.xml
+++ b/appengine/pom.xml
@@ -5,7 +5,7 @@
com.google.auth
google-auth-library-parent
- 0.12.0
+ 0.13.0
../pom.xml
diff --git a/credentials/pom.xml b/credentials/pom.xml
index 3a46f084b..f8439e366 100644
--- a/credentials/pom.xml
+++ b/credentials/pom.xml
@@ -5,7 +5,7 @@
com.google.auth
google-auth-library-parent
- 0.12.0
+ 0.13.0
../pom.xml
diff --git a/oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java b/oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java
index 4d22f2e45..24035f0c7 100644
--- a/oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java
+++ b/oauth2_http/java/com/google/auth/oauth2/CloudShellCredentials.java
@@ -32,12 +32,13 @@
package com.google.auth.oauth2;
import com.google.api.client.json.JsonParser;
+import com.google.common.base.Charsets;
import com.google.common.base.MoreObjects;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
-import java.io.PrintWriter;
+import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.List;
@@ -57,9 +58,10 @@ public class CloudShellCredentials extends GoogleCredentials {
* Javascript Protobufers, preceeded by the message length and a
* new line character. However, the request message has no content,
* so a token request consists of an empty JsPb, and its 2 character
- * lenth prefix.
+ * length prefix.
*/
protected final static String GET_AUTH_TOKEN_REQUEST = "2\n[]";
+ protected final static byte[] GET_AUTH_TOKEN_REQUEST_BYTES = (GET_AUTH_TOKEN_REQUEST + "\n").getBytes(Charsets.UTF_8);
private final int authPort;
@@ -96,10 +98,9 @@ public AccessToken refreshAccessToken() throws IOException {
Socket socket = new Socket("localhost", this.getAuthPort());
socket.setSoTimeout(READ_TIMEOUT_MS);
AccessToken token;
- try {
- PrintWriter out =
- new PrintWriter(socket.getOutputStream(), true);
- out.println(GET_AUTH_TOKEN_REQUEST);
+ try {
+ OutputStream os = socket.getOutputStream();
+ os.write(GET_AUTH_TOKEN_REQUEST_BYTES);
BufferedReader input =
new BufferedReader(new InputStreamReader(socket.getInputStream()));
diff --git a/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
index 49c0f47fd..9a1cd878c 100644
--- a/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
+++ b/oauth2_http/java/com/google/auth/oauth2/ComputeEngineCredentials.java
@@ -222,10 +222,11 @@ static boolean runningOnComputeEngine(
} catch (SocketTimeoutException expected) {
// Ignore logging timeouts which is the expected failure mode in non GCE environments.
} catch (IOException e) {
- LOGGER.log(
- Level.INFO, "Failed to detect whether we are running on Google Compute Engine.", e);
+ LOGGER.log(Level.FINE, "Encountered an unexpected exception when determining" +
+ " if we are running on Google Compute Engine.", e);
}
}
+ LOGGER.log(Level.INFO, "Failed to detect whether we are running on Google Compute Engine.");
return false;
}
diff --git a/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java b/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
index d59103274..1d415e000 100644
--- a/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
+++ b/oauth2_http/java/com/google/auth/oauth2/GoogleCredentials.java
@@ -227,6 +227,17 @@ public GoogleCredentials createScoped(Collection scopes) {
return this;
}
+ /**
+ * If the credentials support scopes, creates a copy of the the identity with the specified
+ * scopes; otherwise, returns the same instance.
+ *
+ * @param scopes Collection of scopes to request.
+ * @return GoogleCredentials with requested scopes.
+ */
+ public GoogleCredentials createScoped(String... scopes) {
+ return createScoped(scopes);
+ }
+
/**
* If the credentials support domain-wide delegation, creates a copy
* of the identity so that it impersonates the specified user;
diff --git a/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java b/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java
index ce7d44301..c00056f51 100644
--- a/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java
+++ b/oauth2_http/javatests/com/google/auth/oauth2/ComputeEngineCredentialsTest.java
@@ -108,11 +108,12 @@ public void getRequestMetadata_missingServiceAccount_throws() {
}
}
+ @Test
public void getRequestMetadata_serverError_throws() {
final String accessToken = "1/MkSJoj1xsli0AccessToken_NKPY2";
MockMetadataServerTransportFactory transportFactory = new MockMetadataServerTransportFactory();
transportFactory.transport.setAccessToken(accessToken);
- transportFactory.transport.setTokenRequestStatusCode(HttpStatusCodes.STATUS_CODE_NOT_FOUND);
+ transportFactory.transport.setTokenRequestStatusCode(HttpStatusCodes.STATUS_CODE_SERVER_ERROR);
ComputeEngineCredentials credentials =
ComputeEngineCredentials.newBuilder().setHttpTransportFactory(transportFactory).build();
try {
diff --git a/oauth2_http/pom.xml b/oauth2_http/pom.xml
index 1c5666602..3045c5df8 100644
--- a/oauth2_http/pom.xml
+++ b/oauth2_http/pom.xml
@@ -5,7 +5,7 @@
com.google.auth
google-auth-library-parent
- 0.12.0
+ 0.13.0
../pom.xml
diff --git a/pom.xml b/pom.xml
index 994bfe545..b2452042b 100644
--- a/pom.xml
+++ b/pom.xml
@@ -10,12 +10,12 @@
com.google.auth
google-auth-library-parent
- 0.12.0
+ 0.13.0
pom
Google Auth Library for Java
Client libraries providing authentication and
authorization to enable calling Google APIs.
- https://github.com/google/google-auth-library-java
+ https://github.com/googleapis/google-auth-library-java
@@ -44,10 +44,9 @@
UTF-8
- 1.6
- 1.27.0
+ 1.28.0
4.12
- 20.0
+ 26.0-android
1.9.64
@@ -159,7 +158,7 @@
org.apache.maven.plugins
maven-surefire-plugin
- 2.22.0
+ 3.0.0-M3
sponge_log
diff --git a/versions.txt b/versions.txt
index 4c0d7de3d..fffa83fad 100644
--- a/versions.txt
+++ b/versions.txt
@@ -1,7 +1,7 @@
# Format:
# module:released-version:current-version
-google-auth-library-parent:0.12.0:0.12.0
-google-auth-library-appengine:0.12.0:0.12.0
-google-auth-library-credentials:0.12.0:0.12.0
-google-auth-library-oauth2-http:0.12.0:0.12.0
+google-auth-library-parent:0.13.0:0.13.0
+google-auth-library-appengine:0.13.0:0.13.0
+google-auth-library-credentials:0.13.0:0.13.0
+google-auth-library-oauth2-http:0.13.0:0.13.0