| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | | using System.ComponentModel; |
| | 7 | | using System.Security.Cryptography; |
| | 8 | | using System.Text; |
| | 9 | | using Azure.Storage.Blobs; |
| | 10 | | using Azure.Storage.Blobs.Models; |
| | 11 | |
|
| | 12 | | namespace Azure.Storage.Sas |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// <see cref="BlobSasBuilder"/> is used to generate a Shared Access |
| | 16 | | /// Signature (SAS) for an Azure Storage container or blob. |
| | 17 | | /// For more information, see |
| | 18 | | /// <see href="https://docs.microsoft.com/en-us/rest/api/storageservices/constructing-a-service-sas"> |
| | 19 | | /// Create a service SAS</see>. |
| | 20 | | /// </summary> |
| | 21 | | public class BlobSasBuilder |
| | 22 | | { |
| | 23 | | /// <summary> |
| | 24 | | /// The storage service version to use to authenticate requests made |
| | 25 | | /// with this shared access signature, and the service version to use |
| | 26 | | /// when handling requests made with this shared access signature. |
| | 27 | | /// </summary> |
| 780 | 28 | | public string Version { get; set; } |
| | 29 | |
|
| | 30 | | /// <summary> |
| | 31 | | /// The optional signed protocol field specifies the protocol |
| | 32 | | /// permitted for a request made with the SAS. Possible values are |
| | 33 | | /// <see cref="SasProtocol.HttpsAndHttp"/>, |
| | 34 | | /// <see cref="SasProtocol.Https"/>, and |
| | 35 | | /// <see cref="SasProtocol.None"/>. |
| | 36 | | /// </summary> |
| 556 | 37 | | public SasProtocol Protocol { get; set; } |
| | 38 | |
|
| | 39 | | /// <summary> |
| | 40 | | /// Optionally specify the time at which the shared access signature |
| | 41 | | /// becomes valid. If omitted when DateTimeOffset.MinValue is used, |
| | 42 | | /// start time for this call is assumed to be the time when the |
| | 43 | | /// storage service receives the request. |
| | 44 | | /// </summary> |
| 564 | 45 | | public DateTimeOffset StartsOn { get; set; } |
| | 46 | |
|
| | 47 | | /// <summary> |
| | 48 | | /// The time at which the shared access signature becomes invalid. |
| | 49 | | /// This field must be omitted if it has been specified in an |
| | 50 | | /// associated stored access policy. |
| | 51 | | /// </summary> |
| 720 | 52 | | public DateTimeOffset ExpiresOn { get; set; } |
| | 53 | |
|
| | 54 | | /// <summary> |
| | 55 | | /// The permissions associated with the shared access signature. The |
| | 56 | | /// user is restricted to operations allowed by the permissions. This |
| | 57 | | /// field must be omitted if it has been specified in an associated |
| | 58 | | /// stored access policy. The <see cref="BlobSasPermissions"/>, |
| | 59 | | /// <see cref="BlobContainerSasPermissions"/>, <see cref="SnapshotSasPermissions"/>, |
| | 60 | | /// or <see cref="BlobAccountSasPermissions"/> can be used to create the |
| | 61 | | /// permissions string. |
| | 62 | | /// </summary> |
| 716 | 63 | | public string Permissions { get; private set; } |
| | 64 | |
|
| | 65 | | /// <summary> |
| | 66 | | /// Specifies an IP address or a range of IP addresses from which to |
| | 67 | | /// accept requests. If the IP address from which the request |
| | 68 | | /// originates does not match the IP address or address range |
| | 69 | | /// specified on the SAS token, the request is not authenticated. |
| | 70 | | /// When specifying a range of IP addresses, note that the range is |
| | 71 | | /// inclusive. |
| | 72 | | /// </summary> |
| 552 | 73 | | public SasIPRange IPRange { get; set; } |
| | 74 | |
|
| | 75 | | /// <summary> |
| | 76 | | /// An optional unique value up to 64 characters in length that |
| | 77 | | /// correlates to an access policy specified for the container. |
| | 78 | | /// </summary> |
| 460 | 79 | | public string Identifier { get; set; } |
| | 80 | |
|
| | 81 | | /// <summary> |
| | 82 | | /// The name of the blob container being made accessible. |
| | 83 | | /// </summary> |
| 384 | 84 | | public string BlobContainerName { get; set; } |
| | 85 | |
|
| | 86 | | /// <summary> |
| | 87 | | /// The name of the blob being made accessible, or |
| | 88 | | /// <see cref="string.Empty"/> for a container SAS. |
| | 89 | | /// </summary> |
| 556 | 90 | | public string BlobName { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// The name of the snapshot being made accessible, or |
| | 94 | | /// <see cref="string.Empty"/> for a blob SAS. |
| | 95 | | /// </summary> |
| 476 | 96 | | public string Snapshot { get; set; } |
| | 97 | |
|
| | 98 | | /// <summary> |
| | 99 | | /// The name of the blob version being made accessible, or |
| | 100 | | /// <see cref="string.Empty"/> for a blob SAS. |
| | 101 | | /// </summary> |
| 428 | 102 | | public string BlobVersionId { get; set; } |
| | 103 | |
|
| | 104 | | /// <summary> |
| | 105 | | /// Specifies which resources are accessible via the shared access |
| | 106 | | /// signature. |
| | 107 | | /// |
| | 108 | | /// Specify "b" if the shared resource is a blob. This grants access to |
| | 109 | | /// the content and metadata of the blob. |
| | 110 | | /// |
| | 111 | | /// Specify "c" if the shared resource is a blob container. This grants |
| | 112 | | /// access to the content and metadata of any blob in the container, |
| | 113 | | /// and to the list of blobs in the container. |
| | 114 | | /// |
| | 115 | | /// Beginning in version 2018-11-09, specify "bs" if the shared resource |
| | 116 | | /// is a blob snapshot. This grants access to the content and |
| | 117 | | /// metadata of the specific snapshot, but not the corresponding root |
| | 118 | | /// blob. |
| | 119 | | /// |
| | 120 | | /// Beginning in version 2019-12-12, specify "bv" if the shared resource |
| | 121 | | /// is a blob version. This grants access to the content and |
| | 122 | | /// metadata of the specific version, but not the corresponding root |
| | 123 | | /// blob. |
| | 124 | | /// </summary> |
| 568 | 125 | | public string Resource { get; set; } |
| | 126 | |
|
| | 127 | | /// <summary> |
| | 128 | | /// Override the value returned for Cache-Control response header. |
| | 129 | | /// </summary> |
| 400 | 130 | | public string CacheControl { get; set; } |
| | 131 | |
|
| | 132 | | /// <summary> |
| | 133 | | /// Override the value returned for Content-Disposition response |
| | 134 | | /// header. |
| | 135 | | /// </summary> |
| 400 | 136 | | public string ContentDisposition { get; set; } |
| | 137 | |
|
| | 138 | | /// <summary> |
| | 139 | | /// Override the value returned for Cache-Encoding response header. |
| | 140 | | /// </summary> |
| 400 | 141 | | public string ContentEncoding { get; set; } |
| | 142 | |
|
| | 143 | | /// <summary> |
| | 144 | | /// Override the value returned for Cache-Language response header. |
| | 145 | | /// </summary> |
| 400 | 146 | | public string ContentLanguage { get; set; } |
| | 147 | |
|
| | 148 | | /// <summary> |
| | 149 | | /// Override the value returned for Cache-Type response header. |
| | 150 | | /// </summary> |
| 400 | 151 | | public string ContentType { get; set; } |
| | 152 | |
|
| | 153 | | /// <summary> |
| | 154 | | /// Sets the permissions for a blob SAS. |
| | 155 | | /// </summary> |
| | 156 | | /// <param name="permissions"> |
| | 157 | | /// <see cref="BlobSasPermissions"/> containing the allowed permissions. |
| | 158 | | /// </param> |
| | 159 | | public void SetPermissions(BlobSasPermissions permissions) |
| | 160 | | { |
| 76 | 161 | | Permissions = permissions.ToPermissionsString(); |
| 76 | 162 | | } |
| | 163 | |
|
| | 164 | | /// <summary> |
| | 165 | | /// Sets the permissions for a blob account level SAS. |
| | 166 | | /// </summary> |
| | 167 | | /// <param name="permissions"> |
| | 168 | | /// <see cref="BlobAccountSasPermissions"/> containing the allowed permissions. |
| | 169 | | /// </param> |
| | 170 | | public void SetPermissions(BlobAccountSasPermissions permissions) |
| | 171 | | { |
| 28 | 172 | | Permissions = permissions.ToPermissionsString(); |
| 28 | 173 | | } |
| | 174 | |
|
| | 175 | | /// <summary> |
| | 176 | | /// Sets the permissions for a blob container SAS. |
| | 177 | | /// </summary> |
| | 178 | | /// <param name="permissions"> |
| | 179 | | /// <see cref="BlobContainerSasPermissions"/> containing the allowed permissions. |
| | 180 | | /// </param> |
| | 181 | | public void SetPermissions(BlobContainerSasPermissions permissions) |
| | 182 | | { |
| 52 | 183 | | Permissions = permissions.ToPermissionsString(); |
| 52 | 184 | | } |
| | 185 | |
|
| | 186 | | /// <summary> |
| | 187 | | /// Sets the permissions for a Snapshot SAS. |
| | 188 | | /// </summary> |
| | 189 | | /// <param name="permissions"> |
| | 190 | | /// <see cref="SnapshotSasPermissions"/> containing the allowed permissions. |
| | 191 | | /// </param> |
| | 192 | | public void SetPermissions(SnapshotSasPermissions permissions) |
| | 193 | | { |
| 12 | 194 | | Permissions = permissions.ToPermissionsString(); |
| 12 | 195 | | } |
| | 196 | |
|
| | 197 | | /// <summary> |
| | 198 | | /// Sets the permissions for a Version SAS. |
| | 199 | | /// </summary> |
| | 200 | | /// <param name="permissions"> |
| | 201 | | /// <see cref="SnapshotSasPermissions"/> containing the allowed permissions. |
| | 202 | | /// </param> |
| | 203 | | public void SetPermissions(BlobVersionSasPermissions permissions) |
| | 204 | | { |
| 8 | 205 | | Permissions = permissions.ToPermissionsString(); |
| 8 | 206 | | } |
| | 207 | |
|
| | 208 | | /// <summary> |
| | 209 | | /// Sets the permissions for the SAS using a raw permissions string. |
| | 210 | | /// </summary> |
| | 211 | | /// <param name="rawPermissions"> |
| | 212 | | /// Raw permissions string for the SAS. |
| | 213 | | /// </param> |
| | 214 | | /// <param name="normalize"> |
| | 215 | | /// If the permissions should be validated and correctly ordered. |
| | 216 | | /// </param> |
| | 217 | | public void SetPermissions( |
| | 218 | | string rawPermissions, |
| | 219 | | bool normalize = default) |
| | 220 | | { |
| 16 | 221 | | if (normalize) |
| | 222 | | { |
| 16 | 223 | | rawPermissions = SasExtensions.ValidateAndSanitizeRawPermissions( |
| 16 | 224 | | permissions: rawPermissions, |
| 16 | 225 | | validPermissionsInOrder: s_validPermissionsInOrder); |
| | 226 | | } |
| | 227 | |
|
| 8 | 228 | | SetPermissions(rawPermissions); |
| 8 | 229 | | } |
| | 230 | |
|
| | 231 | | /// <summary> |
| | 232 | | /// Sets the permissions for the SAS using a raw permissions string. |
| | 233 | | /// </summary> |
| | 234 | | /// <param name="rawPermissions">Raw permissions string for the SAS.</param> |
| | 235 | | public void SetPermissions(string rawPermissions) |
| | 236 | | { |
| 8 | 237 | | Permissions = rawPermissions; |
| 8 | 238 | | } |
| | 239 | |
|
| 4 | 240 | | private static readonly List<char> s_validPermissionsInOrder = new List<char> |
| 4 | 241 | | { |
| 4 | 242 | | Constants.Sas.Permissions.Read, |
| 4 | 243 | | Constants.Sas.Permissions.Add, |
| 4 | 244 | | Constants.Sas.Permissions.Create, |
| 4 | 245 | | Constants.Sas.Permissions.Write, |
| 4 | 246 | | Constants.Sas.Permissions.Delete, |
| 4 | 247 | | Constants.Sas.Permissions.DeleteBlobVersion, |
| 4 | 248 | | Constants.Sas.Permissions.List, |
| 4 | 249 | | Constants.Sas.Permissions.Tag, |
| 4 | 250 | | Constants.Sas.Permissions.Update, |
| 4 | 251 | | Constants.Sas.Permissions.Process, |
| 4 | 252 | | Constants.Sas.Permissions.FilterByTags, |
| 4 | 253 | | }; |
| | 254 | |
|
| | 255 | | /// <summary> |
| | 256 | | /// Use an account's <see cref="StorageSharedKeyCredential"/> to sign this |
| | 257 | | /// shared access signature values to produce the proper SAS query |
| | 258 | | /// parameters for authenticating requests. |
| | 259 | | /// </summary> |
| | 260 | | /// <param name="sharedKeyCredential"> |
| | 261 | | /// The storage account's <see cref="StorageSharedKeyCredential"/>. |
| | 262 | | /// </param> |
| | 263 | | /// <returns> |
| | 264 | | /// The <see cref="BlobSasQueryParameters"/> used for authenticating |
| | 265 | | /// requests. |
| | 266 | | /// </returns> |
| | 267 | | public BlobSasQueryParameters ToSasQueryParameters(StorageSharedKeyCredential sharedKeyCredential) |
| | 268 | | { |
| 128 | 269 | | sharedKeyCredential = sharedKeyCredential ?? throw Errors.ArgumentNull(nameof(sharedKeyCredential)); |
| | 270 | |
|
| 124 | 271 | | EnsureState(); |
| | 272 | |
|
| 124 | 273 | | var startTime = SasExtensions.FormatTimesForSasSigning(StartsOn); |
| 124 | 274 | | var expiryTime = SasExtensions.FormatTimesForSasSigning(ExpiresOn); |
| | 275 | |
|
| | 276 | | // See http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx |
| 124 | 277 | | var stringToSign = String.Join("\n", |
| 124 | 278 | | Permissions, |
| 124 | 279 | | startTime, |
| 124 | 280 | | expiryTime, |
| 124 | 281 | | GetCanonicalName(sharedKeyCredential.AccountName, BlobContainerName ?? String.Empty, BlobName ?? String. |
| 124 | 282 | | Identifier, |
| 124 | 283 | | IPRange.ToString(), |
| 124 | 284 | | SasExtensions.ToProtocolString(Protocol), |
| 124 | 285 | | Version, |
| 124 | 286 | | Resource, |
| 124 | 287 | | Snapshot ?? BlobVersionId, |
| 124 | 288 | | CacheControl, |
| 124 | 289 | | ContentDisposition, |
| 124 | 290 | | ContentEncoding, |
| 124 | 291 | | ContentLanguage, |
| 124 | 292 | | ContentType); |
| | 293 | |
|
| 124 | 294 | | var signature = StorageSharedKeyCredentialInternals.ComputeSasSignature(sharedKeyCredential,stringToSign); |
| | 295 | |
|
| 124 | 296 | | var p = new BlobSasQueryParameters( |
| 124 | 297 | | version: Version, |
| 124 | 298 | | services: default, |
| 124 | 299 | | resourceTypes: default, |
| 124 | 300 | | protocol: Protocol, |
| 124 | 301 | | startsOn: StartsOn, |
| 124 | 302 | | expiresOn: ExpiresOn, |
| 124 | 303 | | ipRange: IPRange, |
| 124 | 304 | | identifier: Identifier, |
| 124 | 305 | | resource: Resource, |
| 124 | 306 | | permissions: Permissions, |
| 124 | 307 | | signature: signature, |
| 124 | 308 | | cacheControl: CacheControl, |
| 124 | 309 | | contentDisposition: ContentDisposition, |
| 124 | 310 | | contentEncoding: ContentEncoding, |
| 124 | 311 | | contentLanguage: ContentLanguage, |
| 124 | 312 | | contentType: ContentType); |
| 124 | 313 | | return p; |
| | 314 | | } |
| | 315 | |
|
| | 316 | | /// <summary> |
| | 317 | | /// Use an account's <see cref="UserDelegationKey"/> to sign this |
| | 318 | | /// shared access signature values to produce the proper SAS query |
| | 319 | | /// parameters for authenticating requests. |
| | 320 | | /// </summary> |
| | 321 | | /// <param name="userDelegationKey"> |
| | 322 | | /// A <see cref="UserDelegationKey"/> returned from |
| | 323 | | /// <see cref="Azure.Storage.Blobs.BlobServiceClient.GetUserDelegationKeyAsync"/>. |
| | 324 | | /// </param> |
| | 325 | | /// <param name="accountName">The name of the storage account.</param> |
| | 326 | | /// <returns> |
| | 327 | | /// The <see cref="BlobSasQueryParameters"/> used for authenticating requests. |
| | 328 | | /// </returns> |
| | 329 | | public BlobSasQueryParameters ToSasQueryParameters(UserDelegationKey userDelegationKey, string accountName) |
| | 330 | | { |
| 64 | 331 | | userDelegationKey = userDelegationKey ?? throw Errors.ArgumentNull(nameof(userDelegationKey)); |
| | 332 | |
|
| 64 | 333 | | EnsureState(); |
| | 334 | |
|
| 64 | 335 | | var startTime = SasExtensions.FormatTimesForSasSigning(StartsOn); |
| 64 | 336 | | var expiryTime = SasExtensions.FormatTimesForSasSigning(ExpiresOn); |
| 64 | 337 | | var signedStart = SasExtensions.FormatTimesForSasSigning(userDelegationKey.SignedStartsOn); |
| 64 | 338 | | var signedExpiry = SasExtensions.FormatTimesForSasSigning(userDelegationKey.SignedExpiresOn); |
| | 339 | |
|
| | 340 | | // See http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx |
| 64 | 341 | | var stringToSign = String.Join("\n", |
| 64 | 342 | | Permissions, |
| 64 | 343 | | startTime, |
| 64 | 344 | | expiryTime, |
| 64 | 345 | | GetCanonicalName(accountName, BlobContainerName ?? String.Empty, BlobName ?? String.Empty), |
| 64 | 346 | | userDelegationKey.SignedObjectId, |
| 64 | 347 | | userDelegationKey.SignedTenantId, |
| 64 | 348 | | signedStart, |
| 64 | 349 | | signedExpiry, |
| 64 | 350 | | userDelegationKey.SignedService, |
| 64 | 351 | | userDelegationKey.SignedVersion, |
| 64 | 352 | | IPRange.ToString(), |
| 64 | 353 | | SasExtensions.ToProtocolString(Protocol), |
| 64 | 354 | | Version, |
| 64 | 355 | | Resource, |
| 64 | 356 | | Snapshot ?? BlobVersionId, |
| 64 | 357 | | CacheControl, |
| 64 | 358 | | ContentDisposition, |
| 64 | 359 | | ContentEncoding, |
| 64 | 360 | | ContentLanguage, |
| 64 | 361 | | ContentType); |
| | 362 | |
|
| 64 | 363 | | var signature = ComputeHMACSHA256(userDelegationKey.Value, stringToSign); |
| | 364 | |
|
| 64 | 365 | | var p = new BlobSasQueryParameters( |
| 64 | 366 | | version: Version, |
| 64 | 367 | | services: default, |
| 64 | 368 | | resourceTypes: default, |
| 64 | 369 | | protocol: Protocol, |
| 64 | 370 | | startsOn: StartsOn, |
| 64 | 371 | | expiresOn: ExpiresOn, |
| 64 | 372 | | ipRange: IPRange, |
| 64 | 373 | | identifier: null, |
| 64 | 374 | | resource: Resource, |
| 64 | 375 | | permissions: Permissions, |
| 64 | 376 | | keyOid: userDelegationKey.SignedObjectId, |
| 64 | 377 | | keyTid: userDelegationKey.SignedTenantId, |
| 64 | 378 | | keyStart: userDelegationKey.SignedStartsOn, |
| 64 | 379 | | keyExpiry: userDelegationKey.SignedExpiresOn, |
| 64 | 380 | | keyService: userDelegationKey.SignedService, |
| 64 | 381 | | keyVersion: userDelegationKey.SignedVersion, |
| 64 | 382 | | signature: signature, |
| 64 | 383 | | cacheControl: CacheControl, |
| 64 | 384 | | contentDisposition: ContentDisposition, |
| 64 | 385 | | contentEncoding: ContentEncoding, |
| 64 | 386 | | contentLanguage: ContentLanguage, |
| 64 | 387 | | contentType: ContentType); |
| 64 | 388 | | return p; |
| | 389 | | } |
| | 390 | |
|
| | 391 | | /// <summary> |
| | 392 | | /// Computes the canonical name for a container or blob resource for SAS signing. |
| | 393 | | /// Container: "/blob/account/containername" |
| | 394 | | /// Blob: "/blob/account/containername/blobname" |
| | 395 | | /// </summary> |
| | 396 | | /// <param name="account">The name of the storage account.</param> |
| | 397 | | /// <param name="containerName">The name of the container.</param> |
| | 398 | | /// <param name="blobName">The name of the blob.</param> |
| | 399 | | /// <returns>The canonical resource name.</returns> |
| | 400 | | private static string GetCanonicalName(string account, string containerName, string blobName) |
| 188 | 401 | | => !String.IsNullOrEmpty(blobName) |
| 188 | 402 | | ? $"/blob/{account}/{containerName}/{blobName.Replace("\\", "/")}" |
| 188 | 403 | | : $"/blob/{account}/{containerName}"; |
| | 404 | |
|
| | 405 | | /// <summary> |
| | 406 | | /// ComputeHMACSHA256 generates a base-64 hash signature string for an |
| | 407 | | /// HTTP request or for a SAS. |
| | 408 | | /// </summary> |
| | 409 | | /// <param name="userDelegationKeyValue"> |
| | 410 | | /// A <see cref="UserDelegationKey.Value"/> used to sign with a key |
| | 411 | | /// representing AD credentials. |
| | 412 | | /// </param> |
| | 413 | | /// <param name="message">The message to sign.</param> |
| | 414 | | /// <returns>The signed message.</returns> |
| | 415 | | private static string ComputeHMACSHA256(string userDelegationKeyValue, string message) => |
| 64 | 416 | | Convert.ToBase64String( |
| 64 | 417 | | new HMACSHA256( |
| 64 | 418 | | Convert.FromBase64String(userDelegationKeyValue)) |
| 64 | 419 | | .ComputeHash(Encoding.UTF8.GetBytes(message))); |
| | 420 | |
|
| | 421 | | /// <summary> |
| | 422 | | /// Ensure the <see cref="BlobSasBuilder"/>'s properties are in a |
| | 423 | | /// consistent state. |
| | 424 | | /// </summary> |
| | 425 | | private void EnsureState() |
| | 426 | | { |
| 188 | 427 | | if (Identifier == default) |
| | 428 | | { |
| 156 | 429 | | if (ExpiresOn == default) |
| | 430 | | { |
| 0 | 431 | | throw Errors.SasMissingData(nameof(ExpiresOn)); |
| | 432 | | } |
| 156 | 433 | | if (string.IsNullOrEmpty(Permissions)) |
| | 434 | | { |
| 0 | 435 | | throw Errors.SasMissingData(nameof(Permissions)); |
| | 436 | | } |
| | 437 | | } |
| | 438 | |
|
| | 439 | | // Container |
| 188 | 440 | | if (string.IsNullOrEmpty(BlobName)) |
| | 441 | | { |
| 72 | 442 | | Resource = Constants.Sas.Resource.Container; |
| | 443 | | } |
| | 444 | |
|
| | 445 | | // Blob or Snapshot |
| | 446 | | else |
| | 447 | | { |
| | 448 | | // Blob |
| 116 | 449 | | if (string.IsNullOrEmpty(Snapshot) && string.IsNullOrEmpty(BlobVersionId)) |
| | 450 | | { |
| 88 | 451 | | Resource = Constants.Sas.Resource.Blob; |
| | 452 | | } |
| | 453 | | // Snapshot |
| 28 | 454 | | else if (string.IsNullOrEmpty(BlobVersionId)) |
| | 455 | | { |
| 20 | 456 | | Resource = Constants.Sas.Resource.BlobSnapshot; |
| | 457 | | } |
| | 458 | | // Blob Version |
| | 459 | | else |
| | 460 | | { |
| 8 | 461 | | Resource = Constants.Sas.Resource.BlobVersion; |
| | 462 | | } |
| | 463 | | } |
| 188 | 464 | | if (string.IsNullOrEmpty(Version)) |
| | 465 | | { |
| 40 | 466 | | Version = SasQueryParameters.DefaultSasVersion; |
| | 467 | | } |
| 188 | 468 | | } |
| | 469 | |
|
| | 470 | | /// <summary> |
| | 471 | | /// Returns a string that represents the current object. |
| | 472 | | /// </summary> |
| | 473 | | /// <returns>A string that represents the current object.</returns> |
| | 474 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 475 | | public override string ToString() => |
| 0 | 476 | | base.ToString(); |
| | 477 | |
|
| | 478 | | /// <summary> |
| | 479 | | /// Check if two BlobSasBuilder instances are equal. |
| | 480 | | /// </summary> |
| | 481 | | /// <param name="obj">The instance to compare to.</param> |
| | 482 | | /// <returns>True if they're equal, false otherwise.</returns> |
| | 483 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| | 484 | | public override bool Equals(object obj) |
| 0 | 485 | | => base.Equals(obj); |
| | 486 | |
|
| | 487 | | /// <summary> |
| | 488 | | /// Get a hash code for the BlobSasBuilder. |
| | 489 | | /// </summary> |
| | 490 | | /// <returns>Hash code for the BlobSasBuilder.</returns> |
| | 491 | | [EditorBrowsable(EditorBrowsableState.Never)] |
| 0 | 492 | | public override int GetHashCode() => base.GetHashCode(); |
| | 493 | | } |
| | 494 | | } |