Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #152 from wastore/dev
Browse files Browse the repository at this point in the history
[9.2][Nov17] Release
  • Loading branch information
erezvani1529 authored May 22, 2018
2 parents bc4a52c + 129f046 commit 4dad44d
Show file tree
Hide file tree
Showing 104 changed files with 1,826 additions and 237 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 9.1.0";
public const string AgentMetadataValue = ".NET 9.2.0";

}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 9.1.0";
public const string AgentMetadataValue = ".NET 9.2.0";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Microsoft.WindowsAzure.Storage.Shared.Protocol

public static class HeaderConstants
{
public static readonly string UserAgent = "Azure-Storage/9.1.0 ";
public static readonly string UserAgent = "Azure-Storage/9.2.0 ";
public const string UserAgentProductName = "Azure-Storage";
public const string UserAgentProductVersion = "9.1.0";
public const string UserAgentProductVersion = "9.2.0";
public const string PrefixForStorageHeader = "x-ms-";
public const string TrueHeader = "true";
public const string FalseHeader = "false";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("9.1.0.0")]
[assembly: AssemblyFileVersion("9.1.0.0")]
[assembly: AssemblyVersion("9.2.0.0")]
[assembly: AssemblyFileVersion("9.2.0.0")]

[assembly: InternalsVisibleTo(
"Microsoft.WindowsAzure.Storage.Facade.Portable, PublicKey=" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Microsoft.WindowsAzure.Storage",
"version": "9.1.0.0",
"version": "9.2.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
6 changes: 3 additions & 3 deletions Lib/AspNet/Microsoft.WindowsAzure.Storage/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("9.1.0.0")]
[assembly: AssemblyFileVersion("9.1.0.0")]
[assembly: AssemblyInformationalVersion("9.1.0.0")]
[assembly: AssemblyVersion("9.2.0.0")]
[assembly: AssemblyFileVersion("9.2.0.0")]
[assembly: AssemblyInformationalVersion("9.2.0.0")]


[assembly: InternalsVisibleTo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>WindowsAzure.Storage</id>
<version>9.1.0</version>
<version>9.2.0</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down
2 changes: 1 addition & 1 deletion Lib/AspNet/Microsoft.WindowsAzure.Storage/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "9.1.0.0",
"version": "9.2.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
77 changes: 77 additions & 0 deletions Lib/ClassLibraryCommon/Auth/Protocol/TokenAuthenticationHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//-----------------------------------------------------------------------
// <copyright file="TokenAuthenticationHandler.cs" company="Microsoft">
// Copyright 2013 Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>
//-----------------------------------------------------------------------

namespace Microsoft.WindowsAzure.Storage.Auth.Protocol
{
using Microsoft.WindowsAzure.Storage.Core;
using Microsoft.WindowsAzure.Storage.Core.Auth;
using Microsoft.WindowsAzure.Storage.Core.Util;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using System;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq;
using System.Net;

/// <summary>
/// Represents a handler that signs HTTPS requests with a token.
/// </summary>
internal sealed class TokenAuthenticationHandler : IAuthenticationHandler
{
private readonly StorageCredentials credentials;

/// <summary>
/// Initializes a new instance of the <see cref="TokenAuthenticationHandler"/> class.
/// </summary>
/// <param name="credentials">A <see cref="StorageCredentials"/> object providing credentials for the request.</param>
public TokenAuthenticationHandler(StorageCredentials credentials)
{
this.credentials = credentials;
}

/// <summary>
/// Signs the specified HTTPS request with a token.
/// </summary>
/// <param name="request">The HTTPS request to sign.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
public void SignRequest(HttpWebRequest request, OperationContext operationContext)
{
CommonUtility.AssertNotNull("request", request);

// only HTTPS is allowed for token credential, as the token would be at risk of being intercepted with HTTP.
#if !WINDOWS_PHONE
if (!"https".Equals(request.Address.Scheme, StringComparison.OrdinalIgnoreCase))
{
throw new InvalidOperationException(SR.OnlyHttpsIsSupportedForTokenCredential);
}
#endif

if (!request.Headers.AllKeys.Contains(Constants.HeaderConstants.Date, StringComparer.Ordinal))
{
string dateString = HttpWebUtility.ConvertDateTimeToHttpString(DateTime.UtcNow);
request.Headers.Add(Constants.HeaderConstants.Date, dateString);
}

if (this.credentials.IsToken)
{
request.Headers.Add(
"Authorization",
string.Format(CultureInfo.InvariantCulture, "Bearer {0}", this.credentials.TokenCredential.Token));
}
}
}
}
3 changes: 2 additions & 1 deletion Lib/ClassLibraryCommon/Blob/CloudBlob.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4114,7 +4114,7 @@ private async Task<WrappedKeyData> RotateEncryptionHelper(AccessCondition access
{
throw new InvalidOperationException(SR.KeyRotationNoKeyID);
}

// Use the key resolver to resolve the old KEK.
Azure.KeyVault.Core.IKey oldKey = await modifiedOptions.EncryptionPolicy.KeyResolver.ResolveKeyAsync(encryptionData.WrappedContentKey.KeyId, cancellationToken).ConfigureAwait(false);
if (oldKey == null)
Expand Down Expand Up @@ -4184,6 +4184,7 @@ internal static void UpdateETagLMTLengthAndSequenceNumber(BlobAttributes blobAtt
{
BlobProperties parsedProperties = BlobHttpResponseParsers.GetProperties(response);
blobAttributes.Properties.ETag = parsedProperties.ETag ?? blobAttributes.Properties.ETag;
blobAttributes.Properties.Created = parsedProperties.Created ?? blobAttributes.Properties.Created;
blobAttributes.Properties.LastModified = parsedProperties.LastModified ?? blobAttributes.Properties.LastModified;
blobAttributes.Properties.PageBlobSequenceNumber = parsedProperties.PageBlobSequenceNumber ?? blobAttributes.Properties.PageBlobSequenceNumber;
blobAttributes.Properties.AppendBlobCommittedBlockCount = parsedProperties.AppendBlobCommittedBlockCount ?? blobAttributes.Properties.AppendBlobCommittedBlockCount;
Expand Down
4 changes: 4 additions & 0 deletions Lib/ClassLibraryCommon/Blob/CloudBlobClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,10 @@ internal IAuthenticationHandler AuthenticationHandler
this.Credentials,
this.Credentials.AccountName);
}
else if (this.Credentials.IsToken)
{
result = new TokenAuthenticationHandler(this.Credentials);
}
else
{
result = new NoOpAuthenticationHandler();
Expand Down
2 changes: 1 addition & 1 deletion Lib/ClassLibraryCommon/Blob/CloudBlobContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,7 @@ public virtual Task DeleteAsync(AccessCondition accessCondition, BlobRequestOpti
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the condition that must be met in order for the request to proceed. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="BlobRequestOptions"/> object that specifies additional options for the request. If <c>null</c>, default options are applied to the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
/// <returns><c>true</c> if the container did not already exist and was created; otherwise <c>false</c>.</returns>
/// <returns><c>true</c> if the container existed and was deleted successfully; otherwise <c>false</c>.</returns>
[DoesServiceRequest]
public virtual bool DeleteIfExists(AccessCondition accessCondition = null, BlobRequestOptions options = null, OperationContext operationContext = null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,13 @@ public static BlobProperties GetProperties(HttpWebResponse response)
properties.ETag = HttpResponseParsers.GetETag(response);

#if WINDOWS_PHONE
properties.Created = HttpResponseParsers.GetCreated(response);
properties.LastModified = HttpResponseParsers.GetLastModified(response);
properties.ContentLanguage = response.Headers[Constants.HeaderConstants.ContentLanguageHeader];
#else
string created = response.Headers[Constants.HeaderConstants.CreationTimeHeader];
properties.Created = string.IsNullOrEmpty(created) ? (DateTimeOffset?)null : DateTimeOffset.Parse(created).ToUniversalTime();

properties.LastModified = response.LastModified.ToUniversalTime();
properties.ContentLanguage = response.Headers[HttpResponseHeader.ContentLanguage];
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ namespace Microsoft.WindowsAzure.Storage.Blob.Protocol
using Microsoft.WindowsAzure.Storage.Core.Util;
using Microsoft.WindowsAzure.Storage.Shared.Protocol;
using System.Collections.Generic;
using System.Globalization;
using System.Net;

/// <summary>
Expand Down Expand Up @@ -60,8 +61,17 @@ public static BlobContainerProperties GetProperties(HttpWebResponse response)
containerProperties.LeaseStatus = BlobHttpResponseParsers.GetLeaseStatus(response);
containerProperties.LeaseState = BlobHttpResponseParsers.GetLeaseState(response);
containerProperties.LeaseDuration = BlobHttpResponseParsers.GetLeaseDuration(response);

// Reading public access
containerProperties.PublicAccess = GetAcl(response);

// WORM policies
string hasImmutability = response.Headers[Constants.HeaderConstants.HasImmutabilityPolicyHeader];
containerProperties.HasImmutabilityPolicy = string.IsNullOrEmpty(hasImmutability) ? (bool?)null : bool.Parse(hasImmutability);

string hasLegalHold = response.Headers[Constants.HeaderConstants.HasLegalHoldHeader];
containerProperties.HasLegalHold = string.IsNullOrEmpty(hasLegalHold) ? (bool?)null : bool.Parse(hasLegalHold);

return containerProperties;
}

Expand Down
14 changes: 7 additions & 7 deletions Lib/ClassLibraryCommon/File/CloudFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public virtual Task<Stream> OpenReadAsync(AccessCondition accessCondition, FileR
/// <summary>
/// Opens a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the access conditions for the file. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
Expand Down Expand Up @@ -218,7 +218,7 @@ public virtual CloudFileStream OpenWrite(long? size, AccessCondition accessCondi
/// <summary>
/// Begins an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="callback">The callback delegate that will receive notification when the asynchronous operation completes.</param>
/// <param name="state">A user-defined object that will be passed to the callback delegate.</param>
/// <returns>An <see cref="ICancellableAsyncResult"/> that references the asynchronous operation.</returns>
Expand All @@ -231,7 +231,7 @@ public virtual ICancellableAsyncResult BeginOpenWrite(long? size, AsyncCallback
/// <summary>
/// Begins an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the access conditions for the file. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
Expand Down Expand Up @@ -334,7 +334,7 @@ public virtual CloudFileStream EndOpenWrite(IAsyncResult asyncResult)
/// <summary>
/// Returns a task that performs an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <returns>A <see cref="Task{T}"/> object that represents the current operation.</returns>
[DoesServiceRequest]
public virtual Task<CloudFileStream> OpenWriteAsync(long? size)
Expand All @@ -345,7 +345,7 @@ public virtual Task<CloudFileStream> OpenWriteAsync(long? size)
/// <summary>
/// Returns a task that performs an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe while waiting for a task to complete.</param>
/// <returns>A <see cref="Task{T}"/> object that represents the current operation.</returns>
[DoesServiceRequest]
Expand All @@ -357,7 +357,7 @@ public virtual Task<CloudFileStream> OpenWriteAsync(long? size, CancellationToke
/// <summary>
/// Returns a task that performs an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the access conditions for the file. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
Expand All @@ -371,7 +371,7 @@ public virtual Task<CloudFileStream> OpenWriteAsync(long? size, AccessCondition
/// <summary>
/// Returns a task that performs an asynchronous operation to open a stream for writing to the file. If the file already exists, then existing data in the file may be overwritten.
/// </summary>
/// <param name="size">The size of the new file, in bytes. If null, the file must already exist, otherwise a new file of the given size will be created.</param>
/// <param name="size">The size of the file to create, in bytes, or null. If null, the file must already exist. If not null, a new file of the given size will be created. If size is not null but the file already exists on the service, the already-existing file will be deleted.</param>
/// <param name="accessCondition">An <see cref="AccessCondition"/> object that represents the access conditions for the file. If <c>null</c>, no condition is used.</param>
/// <param name="options">A <see cref="FileRequestOptions"/> object that specifies additional options for the request.</param>
/// <param name="operationContext">An <see cref="OperationContext"/> object that represents the context for the current operation.</param>
Expand Down
Loading

0 comments on commit 4dad44d

Please sign in to comment.