Update Google API dependencies for GData extension (#2754)

* Update Google API dependencies for Sheets & Drive

Remove unnecessary direct dependencies which are transitive
dependencies of those.

* Fix use of deprecated class
This commit is contained in:
Tom Morris 2020-06-23 15:55:46 -04:00 committed by GitHub
parent 1849e62234
commit d97d6c66b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 18 deletions

View File

@ -126,25 +126,15 @@
<artifactId>httpclient</artifactId>
<version>4.5.12</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.oauth-client</groupId>
<artifactId>google-oauth-client-jetty</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-drive</artifactId>
<version>v3-rev101-1.23.0</version>
<version>v3-rev20200413-1.30.9</version>
</dependency>
<dependency>
<groupId>com.google.apis</groupId>
<artifactId>google-api-services-sheets</artifactId>
<version>v4-rev502-1.23.0</version>
<version>v4-rev20200508-1.30.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
@ -152,7 +142,6 @@
<version>${jackson.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>

View File

@ -13,14 +13,14 @@ import javax.servlet.http.HttpServletRequest;
import com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl;
import com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest;
import com.google.api.client.googleapis.auth.oauth2.GoogleCredential;
import com.google.api.client.auth.oauth2.Credential;
import com.google.api.client.googleapis.auth.oauth2.GoogleTokenResponse;
import com.google.api.client.http.HttpRequest;
import com.google.api.client.http.HttpRequestInitializer;
import com.google.api.client.http.HttpTransport;
import com.google.api.client.http.javanet.NetHttpTransport;
import com.google.api.client.json.JsonFactory;
import com.google.api.client.json.jackson.JacksonFactory;
import com.google.api.client.json.jackson2.JacksonFactory;
import com.google.api.services.drive.Drive;
import com.google.api.services.drive.DriveScopes;
import com.google.api.services.sheets.v4.Sheets;
@ -110,7 +110,7 @@ abstract public class GoogleAPIExtension {
}
static public Drive getDriveService(String token) {
GoogleCredential credential = new GoogleCredential().setAccessToken(token);
Credential credential = new Credential.Builder(null).build().setAccessToken(token);
return new Drive.Builder(HTTP_TRANSPORT, JSON_FACTORY, credential).setHttpRequestInitializer(new HttpRequestInitializer() {
@Override
@ -156,7 +156,7 @@ abstract public class GoogleAPIExtension {
* @throws IOException
*/
public static Sheets getSheetsService(String token) throws IOException {
GoogleCredential credential = new GoogleCredential().setAccessToken(token);
Credential credential = new Credential.Builder(null).build().setAccessToken(token);
int connectTimeout = getConnectTimeout();
int readTimeout = getReadTimeout();