Skip to content

Commit 0c50a2a

Browse files
author
Ajay Kannan
committed
---
yaml --- r: 1405 b: refs/heads/master c: 18cbb77 h: refs/heads/master i: 1403: 8edb458
1 parent 1ef266e commit 0c50a2a

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
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: af94b5312daa978b693ce38b5f2314a335f3d531
2+
refs/heads/master: 18cbb774258a77172a988d7a84c5e559d57b0c95
33
refs/heads/travis: e21ee7b88a5edc3f3d8c71f90c3fc32abf7e8dd6
44
refs/heads/gh-pages: d1b373c30c176edc08692348167bec3a244bb823
55
refs/heads/bigquery: 762fa5830e6c398c0396177e3e7fd243bd62cfc3

trunk/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)