From 6522eb168060c6646c932ebff91da4f67559ced9 Mon Sep 17 00:00:00 2001 From: kolea2 Date: Wed, 27 Mar 2019 15:02:26 -0400 Subject: [PATCH 1/4] Add back in deprecated methods in ServiceAccountJwtAccessCredentials --- .../ServiceAccountJwtAccessCredentials.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java index 976e6fa6d..765e112e0 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java @@ -96,6 +96,22 @@ public class ServiceAccountJwtAccessCredentials extends Credentials @VisibleForTesting transient Clock clock = Clock.SYSTEM; + /** + * Constructor with minimum identifying information. + * + * @param clientId Client ID of the service account from the console. May be null. + * @param clientEmail Client email address of the service account from the console. + * @param privateKey RSA private key object for the service account. + * @param privateKeyId Private key identifier for the service account. May be null. + * @deprecated Use {@link #newBuilder()} instead. This constructor will either be deleted or made + * private in a later version. + */ + @Deprecated + public ServiceAccountJwtAccessCredentials( + String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId) { + this(clientId, clientEmail, privateKey, privateKeyId, null); + } + /** * Constructor with full information. * @@ -104,8 +120,11 @@ public class ServiceAccountJwtAccessCredentials extends Credentials * @param privateKey RSA private key object for the service account. * @param privateKeyId Private key identifier for the service account. May be null. * @param defaultAudience Audience to use if not provided by transport. May be null. + * @deprecated Use {@link #newBuilder()} instead. This constructor will either be deleted or made + * private in a later version. */ - private ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, + @Deprecated + public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, URI defaultAudience) { this.clientId = clientId; this.clientEmail = Preconditions.checkNotNull(clientEmail); @@ -116,7 +135,7 @@ private ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, } /** - * Returns service account credentials defined by JSON using the format supported by the Google + * Returns service account crentials defined by JSON using the format supported by the Google * Developers Console. * * @param json a map from the JSON representing the credentials. From f788fd803bc10ff15bb13b9c3762909997bd865f Mon Sep 17 00:00:00 2001 From: kolea2 Date: Wed, 27 Mar 2019 15:04:11 -0400 Subject: [PATCH 2/4] typo fix --- .../google/auth/oauth2/ServiceAccountJwtAccessCredentials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java index 765e112e0..c2080f700 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java @@ -135,7 +135,7 @@ public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, } /** - * Returns service account crentials defined by JSON using the format supported by the Google + * Returns service account credentials defined by JSON using the format supported by the Google * Developers Console. * * @param json a map from the JSON representing the credentials. From 5adaee0af63a6b7143df26c35f5291a70fb7c3bd Mon Sep 17 00:00:00 2001 From: kolea2 Date: Wed, 27 Mar 2019 15:28:23 -0400 Subject: [PATCH 3/4] change constructor to private --- .../google/auth/oauth2/ServiceAccountJwtAccessCredentials.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java index c2080f700..52b9c69ff 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java @@ -124,7 +124,7 @@ public ServiceAccountJwtAccessCredentials( * private in a later version. */ @Deprecated - public ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, + private ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, URI defaultAudience) { this.clientId = clientId; this.clientEmail = Preconditions.checkNotNull(clientEmail); From 3d5346b317942c4d95415e1a3b309b809d8adf52 Mon Sep 17 00:00:00 2001 From: kolea2 Date: Wed, 27 Mar 2019 15:30:27 -0400 Subject: [PATCH 4/4] change constructor to private --- .../google/auth/oauth2/ServiceAccountJwtAccessCredentials.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java index 52b9c69ff..a203b7ad3 100644 --- a/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java +++ b/oauth2_http/java/com/google/auth/oauth2/ServiceAccountJwtAccessCredentials.java @@ -120,10 +120,7 @@ public ServiceAccountJwtAccessCredentials( * @param privateKey RSA private key object for the service account. * @param privateKeyId Private key identifier for the service account. May be null. * @param defaultAudience Audience to use if not provided by transport. May be null. - * @deprecated Use {@link #newBuilder()} instead. This constructor will either be deleted or made - * private in a later version. */ - @Deprecated private ServiceAccountJwtAccessCredentials(String clientId, String clientEmail, PrivateKey privateKey, String privateKeyId, URI defaultAudience) { this.clientId = clientId;