Skip to content

Commit 923a6f1

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 2535 b: refs/heads/update-datastore c: 18cbb77 h: refs/heads/master i: 2533: a7021fa 2531: 5fe7bab 2527: d38ebf9
1 parent 5d2ba45 commit 923a6f1

2 files changed

Lines changed: 8 additions & 12 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/gh-pages: 4e0561bb4504bf647db669a14417b2b2c87ba45d
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3
66
refs/heads/pubsub-alpha: 1a0e970f265af871e02274085b9662b3fe29058b
77
refs/heads/resource-manager: ebf4adc5ee835cd2086c4ac5b4e78d01a5a005a7
8-
refs/heads/update-datastore: af94b5312daa978b693ce38b5f2314a335f3d531
8+
refs/heads/update-datastore: 18cbb774258a77172a988d7a84c5e559d57b0c95
99
refs/tags/0.0.9: 22f1839238f66c39e67ed4dfdcd273b1ae2e8444
1010
refs/tags/v0.0.10: 207ebd2a3472fddee69fe1298eb90429e3306efd
1111
refs/tags/v0.0.11: ffbfba48a6426ff63c08ff2117e58681f251fbf2

branches/update-datastore/gcloud-java-storage/src/main/java/com/google/gcloud/storage/StorageImpl.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
import static java.nio.charset.StandardCharsets.UTF_8;
3232

3333
import com.google.api.services.storage.model.StorageObject;
34-
import com.google.auth.oauth2.GoogleCredentials;
3534
import com.google.auth.oauth2.ServiceAccountCredentials;
3635
import com.google.common.base.Function;
3736
import com.google.common.base.Functions;
@@ -43,7 +42,6 @@
4342
import com.google.common.hash.Hashing;
4443
import com.google.common.io.BaseEncoding;
4544
import com.google.common.primitives.Ints;
46-
import com.google.gcloud.AuthCredentials;
4745
import com.google.gcloud.AuthCredentials.ServiceAccountAuthCredentials;
4846
import com.google.gcloud.BaseService;
4947
import com.google.gcloud.ExceptionHandler;
@@ -562,18 +560,16 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio
562560
for (SignUrlOption option : options) {
563561
optionMap.put(option.option(), option.value());
564562
}
565-
ServiceAccountAuthCredentials serviceAccountAuthCred =
563+
ServiceAccountAuthCredentials authCred =
566564
(ServiceAccountAuthCredentials) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED);
567-
ServiceAccountCredentials cred = (ServiceAccountCredentials) (serviceAccountAuthCred != null
568-
? serviceAccountAuthCred.credentials() : null);
569-
if (serviceAccountAuthCred == null) {
570-
AuthCredentials authCred = this.options().authCredentials();
571-
GoogleCredentials serviceCred =
572-
authCred != null ? authCred.credentials() : null;
565+
ServiceAccountCredentials cred =
566+
(ServiceAccountCredentials) (authCred != null ? authCred.credentials() : null);
567+
if (authCred == null) {
573568
checkArgument(
574-
serviceCred instanceof ServiceAccountCredentials,
569+
this.options().authCredentials() != null
570+
&& this.options().authCredentials().credentials() instanceof ServiceAccountCredentials,
575571
"Signing key was not provided and could not be derived");
576-
cred = (ServiceAccountCredentials) serviceCred;
572+
cred = (ServiceAccountCredentials) this.options().authCredentials().credentials();
577573
}
578574
// construct signature - see https://cloud.google.com/storage/docs/access-control#Signed-URLs
579575
StringBuilder stBuilder = new StringBuilder();

0 commit comments

Comments
 (0)