-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rename SigningCredentials to ServiceAccountSigner
- Loading branch information
Showing
7 changed files
with
76 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ | |
import com.google.gcloud.PageImpl.NextPageFetcher; | ||
import com.google.gcloud.ReadChannel; | ||
import com.google.gcloud.RetryHelper.RetryHelperException; | ||
import com.google.gcloud.SigningAuthCredentials; | ||
import com.google.gcloud.ServiceAccountSigner; | ||
import com.google.gcloud.storage.spi.StorageRpc; | ||
import com.google.gcloud.storage.spi.StorageRpc.RewriteResponse; | ||
import com.google.gcloud.storage.spi.StorageRpc.Tuple; | ||
|
@@ -533,13 +533,12 @@ public URL signUrl(BlobInfo blobInfo, long duration, TimeUnit unit, SignUrlOptio | |
for (SignUrlOption option : options) { | ||
optionMap.put(option.option(), option.value()); | ||
} | ||
SigningAuthCredentials authCredentials = | ||
(SigningAuthCredentials) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED); | ||
ServiceAccountSigner authCredentials = | ||
(ServiceAccountSigner) optionMap.get(SignUrlOption.Option.SERVICE_ACCOUNT_CRED); | ||
if (authCredentials == null) { | ||
checkArgument(this.options().authCredentials() != null | ||
&& this.options().authCredentials() instanceof SigningAuthCredentials, | ||
checkArgument(this.options().authCredentials() instanceof ServiceAccountSigner, | ||
This comment has been minimized.
Sorry, something went wrong.
aozarov
Contributor
|
||
"Signing key was not provided and could not be derived"); | ||
authCredentials = (SigningAuthCredentials) this.options().authCredentials(); | ||
authCredentials = (ServiceAccountSigner) this.options().authCredentials(); | ||
} | ||
// construct signature - see https://cloud.google.com/storage/docs/access-control#Signed-URLs | ||
StringBuilder stBuilder = new StringBuilder(); | ||
|
I think we can make this javadoc more clear with the order of a signer lookup (provided, given credentials, default credentials) and exception otherwise.
Also, I wonder if we should change the exception to
IllegalStateException
as if signer argument is provided it will never throw that exception, so such exception is only thrown when argument is not provided...