/// <summary> /// Use an account's <see cref="StorageSharedKeyCredential"/> to sign this /// shared access signature values to produce the proper SAS query /// parameters for authenticating requests. /// </summary> /// <param name="sharedKeyCredential"> /// The storage account's <see cref="StorageSharedKeyCredential"/>. /// </param> /// <returns> /// The <see cref="DataLakeSasQueryParameters"/> used for authenticating /// requests. /// </returns> public DataLakeSasQueryParameters ToSasQueryParameters(StorageSharedKeyCredential sharedKeyCredential) { sharedKeyCredential = sharedKeyCredential ?? throw Errors.ArgumentNull(nameof(sharedKeyCredential)); EnsureState(); var startTime = SasExtensions.FormatTimesForSasSigning(StartsOn); var expiryTime = SasExtensions.FormatTimesForSasSigning(ExpiresOn); // See http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx var stringToSign = String.Join("\n", Permissions, startTime, expiryTime, GetCanonicalName(sharedKeyCredential.AccountName, FileSystemName ?? String.Empty, Path ?? String.Empty), Identifier, IPRange.ToString(), SasExtensions.ToProtocolString(Protocol), Version, Resource, null, // snapshot CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentType); var signature = StorageSharedKeyCredentialInternals.ComputeSasSignature(sharedKeyCredential, stringToSign); var p = new DataLakeSasQueryParameters( version: Version, services: default,
/// <summary> /// Use an account's <see cref="StorageSharedKeyCredential"/> to sign this /// shared access signature values to produce the proper SAS query /// parameters for authenticating requests. /// </summary> /// <param name="sharedKeyCredential"> /// The storage account's <see cref="StorageSharedKeyCredential"/>. /// </param> /// <returns> /// The <see cref="SasQueryParameters"/> used for authenticating /// requests. /// </returns> public SasQueryParameters ToSasQueryParameters(StorageSharedKeyCredential sharedKeyCredential) { sharedKeyCredential = sharedKeyCredential ?? throw Errors.ArgumentNull(nameof(sharedKeyCredential)); if (ExpiresOn == default) { throw Errors.SasMissingData(nameof(ExpiresOn)); } if (string.IsNullOrEmpty(Permissions)) { throw Errors.SasMissingData(nameof(Permissions)); } if (string.IsNullOrEmpty(Version)) { Version = SasQueryParameters.DefaultSasVersion; } var startTime = SasExtensions.FormatTimesForSasSigning(StartsOn); var expiryTime = SasExtensions.FormatTimesForSasSigning(ExpiresOn); // String to sign: http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx var stringToSign = string.Join("\n", Permissions, startTime, expiryTime, GetCanonicalName(sharedKeyCredential.AccountName, QueueName ?? string.Empty), Identifier, IPRange.ToString(), SasExtensions.ToProtocolString(Protocol), Version); var signature = StorageSharedKeyCredentialInternals.ComputeSasSignature(sharedKeyCredential, stringToSign); var p = SasQueryParametersInternals.Create( version: Version, services: default,
/// <summary> /// Use an account's <see cref="StorageSharedKeyCredential"/> to sign this /// shared access signature values to produce the proper SAS query /// parameters for authenticating requests. /// </summary> /// <param name="sharedKeyCredential"> /// The storage account's <see cref="StorageSharedKeyCredential"/>. /// </param> /// <returns> /// The <see cref="DataLakeSasQueryParameters"/> used for authenticating /// requests. /// </returns> public DataLakeSasQueryParameters ToSasQueryParameters(StorageSharedKeyCredential sharedKeyCredential) { sharedKeyCredential = sharedKeyCredential ?? throw Errors.ArgumentNull(nameof(sharedKeyCredential)); EnsureState(); string startTime = SasExtensions.FormatTimesForSasSigning(StartsOn); string expiryTime = SasExtensions.FormatTimesForSasSigning(ExpiresOn); // See http://msdn.microsoft.com/en-us/library/azure/dn140255.aspx string stringToSign; // TODO https://github.com/Azure/azure-sdk-for-net/issues/23369 if (SasQueryParametersInternals.DefaultSasVersionInternal == "2020-12-06") { stringToSign = string.Join("\n", Permissions, startTime, expiryTime, GetCanonicalName(sharedKeyCredential.AccountName, FileSystemName ?? string.Empty, Path ?? string.Empty), Identifier, IPRange.ToString(), SasExtensions.ToProtocolString(Protocol), Version, Resource, null, // snapshot null, // encryption scope CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentType); } else { stringToSign = string.Join("\n", Permissions, startTime, expiryTime, GetCanonicalName(sharedKeyCredential.AccountName, FileSystemName ?? string.Empty, Path ?? string.Empty), Identifier, IPRange.ToString(), SasExtensions.ToProtocolString(Protocol), Version, Resource, null, // snapshot CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentType); } string signature = StorageSharedKeyCredentialInternals.ComputeSasSignature(sharedKeyCredential, stringToSign); DataLakeSasQueryParameters p = new DataLakeSasQueryParameters( version: Version, services: default,