diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/Conformance/V4SignerConformanceTest.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/Conformance/V4SignerConformanceTest.cs
index f2c53df38a43..8f4075f8356d 100644
--- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/Conformance/V4SignerConformanceTest.cs
+++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1.Tests/Conformance/V4SignerConformanceTest.cs
@@ -64,7 +64,7 @@ public void StorageClientSignerTest(SigningV4Test test)
(test.ClientEndpoint.StartsWith("http") ? test.ClientEndpoint : $"https://{test.ClientEndpoint}"),
Credential = StorageConformanceTestData.TestCredential,
}.Build();
- var signer = storageClient.UrlSigner;
+ var signer = storageClient.CreateUrlSigner();
SignerTest(test, signer);
}
diff --git a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/StorageClient.cs b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/StorageClient.cs
index 8c0d15a7b983..b76062510190 100644
--- a/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/StorageClient.cs
+++ b/apis/Google.Cloud.Storage.V1/Google.Cloud.Storage.V1/StorageClient.cs
@@ -66,41 +66,6 @@ public abstract partial class StorageClient : IDisposable
///
public virtual EncryptionKey EncryptionKey { get { throw new NotImplementedException(); } }
- ///
- /// A URL signer built base on this client, that is using the same credential as this client, as well
- /// as defaulting to this client's URI scheme and host. If the credential used by this client is not compatible
- /// with this will be null. See 's documentation for more information
- /// on compatible credentials.
- ///
- ///
- /// Because credentials used by this client may changed, this property will return a new instance
- /// each time it is called.
- ///
- public UrlSigner UrlSigner
- {
- get
- {
- UrlSigner signer;
- try
- {
- signer = UrlSigner.FromCredential(Service.HttpClient.MessageHandler.Credential);
- }
- catch (InvalidOperationException)
- {
- // The credential does not support signing.
- return null;
- }
-
- var baseUri = new Uri(Service.BaseUri);
- return signer.WithDefaultOptionsOverride(new UrlSigner.DefaultOptionsOverrides(
- baseUri.Scheme, baseUri.Host,
- // If the original URI didn't specify a port, we want signed URLs to not have a port either;
- // but Uri.Port returns the default port for the URI scheme when the port was not specified on the
- // original URI.
- baseUri.IsDefaultPort && !Service.BaseUri.Contains(baseUri.Port.ToString()) ? null : baseUri.Port));
- }
- }
-
///
/// Asynchronously creates a using application default credentials.
/// For any non-default values, please use .
@@ -167,6 +132,29 @@ public static StorageClient CreateUnauthenticated() =>
UnauthenticatedAccess = true
}.Build();
+ ///
+ /// Creates a URL signer built base on this client, that is using the same credential as this client, as well
+ /// as defaulting to this client's URI scheme, host and port. If the credential used by this client is not compatible
+ /// with this method will throw .
+ /// See 's documentation for more information on compatible credentials.
+ ///
+ ///
+ /// Because credentials used by this client may changed, this method will always return a new instance
+ /// each time it is called.
+ ///
+ public UrlSigner CreateUrlSigner()
+ {
+ UrlSigner signer = UrlSigner.FromCredential(Service.HttpClient.MessageHandler.Credential);
+
+ var baseUri = new Uri(Service.BaseUri);
+ return signer.WithDefaultOptionsOverride(new UrlSigner.DefaultOptionsOverrides(
+ baseUri.Scheme, baseUri.Host,
+ // If the original URI didn't specify a port, we want signed URLs to not have a port either;
+ // but Uri.Port returns the default port for the URI scheme when the port was not specified on the
+ // original URI.
+ baseUri.IsDefaultPort && !Service.BaseUri.Contains(baseUri.Port.ToString()) ? null : baseUri.Port));
+ }
+
///
/// Dispose of this instance. See the remarks on when this should be called.
///