Skip to content
This repository has been archived by the owner on Sep 29, 2021. It is now read-only.

Commit

Permalink
Upgrade google-auth-library-java from 0.7.1 to 0.10.0
Browse files Browse the repository at this point in the history
so we can use `Oauth2Credentials.refreshAccessToken()` instead of `getRequestMetadata()`.

See googleapis/google-auth-library-java#147.
  • Loading branch information
davidxia committed Aug 15, 2018
1 parent fb0f0da commit e46845a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
Expand Up @@ -39,7 +39,7 @@ class GoogleCredentialsAccessTokenSupplier implements Supplier<Optional<AccessTo
private static final Logger LOG =
LoggerFactory.getLogger(GoogleCredentialsAccessTokenSupplier.class);

public static final List<String> DEFAULT_SCOPES = ImmutableList.of(
static final List<String> DEFAULT_SCOPES = ImmutableList.of(
"https://www.googleapis.com/auth/cloud-platform.read-only",
"https://www.googleapis.com/auth/userinfo.email"
);
Expand Down Expand Up @@ -80,7 +80,7 @@ public Optional<AccessToken> get() {
if (credentials == null) {
credentials = getCredentialsWithScopes(tokenScopes);
}
credentials.getRequestMetadata(null);
credentials.refreshAccessToken();
}

tokenOpt = Optional.of(credentials.getAccessToken());
Expand Down
Expand Up @@ -22,15 +22,13 @@

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.equalTo;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;

import com.google.auth.oauth2.AccessToken;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.common.base.Optional;
import java.io.IOException;
import java.net.URI;
import org.junit.Test;

public class GoogleCredentialsAccessTokenSupplierTest {
Expand All @@ -56,6 +54,6 @@ public void testGetWithCredentials() throws IOException {
final GoogleCredentialsAccessTokenSupplier supplier = new GoogleCredentialsAccessTokenSupplier(
true, null, null, credentials);
supplier.get();
verify(credentials).getRequestMetadata(any(URI.class));
verify(credentials).refreshAccessToken();
}
}
4 changes: 2 additions & 2 deletions pom.xml
Expand Up @@ -358,12 +358,12 @@
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-credentials</artifactId>
<version>0.7.1</version>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>com.google.auth</groupId>
<artifactId>google-auth-library-oauth2-http</artifactId>
<version>0.7.1</version>
<version>0.10.0</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
Expand Down

0 comments on commit e46845a

Please sign in to comment.