public static void SignRequest(HttpWebRequest request, FileContext context) { Assert.IsNotNull(request); Assert.IsNotNull(context); OperationContext opContext = new OperationContext(); SharedKeyAuthenticationHandler handler = new SharedKeyAuthenticationHandler( SharedKeyCanonicalizer.Instance, context.Credentials, context.Account); handler.SignRequest(request, opContext); FileTestUtils.AuthorizationHeader(request, true, context.Account); FileTestUtils.DateHeader(request, true); }
public SharedKeyLiteAuthenticationHandler(ICanonicalizer canonicalizer, StorageCredentials credentials, string resourceAccountName) { this.authenticationHandler = new SharedKeyAuthenticationHandler(canonicalizer, credentials, resourceAccountName); }
private static HttpWebRequest BlobGetRequest(KeyValuePair<long, int> blockOffsetAndLength, CloudBlockBlob blob) { StorageCredentials credentials = blob.ServiceClient.Credentials; var transformedUri = credentials.TransformUri(blob.Uri); // Prepare the HttpWebRequest to download data from the chunk. HttpWebRequest blobGetRequest = BlobHttpWebRequestFactory.Get( transformedUri, Timeout, snapshot: null, offset: blockOffsetAndLength.Key, count: blockOffsetAndLength.Value, rangeContentMD5: false, accessCondition: AccessCondition.GenerateEmptyCondition(), operationContext: new OperationContext()); if (credentials.IsSharedKey) { IAuthenticationHandler authenticationHandler = new SharedKeyAuthenticationHandler( SharedKeyCanonicalizer.Instance, credentials, credentials.AccountName); authenticationHandler.SignRequest(blobGetRequest, new OperationContext()); } return blobGetRequest; }
public SharedKeyLiteAuthenticationHandler(ICanonicalizer canonicalizer, StorageCredentials credentials, string resourceAccountName) { this.authenticationHandler = new SharedKeyAuthenticationHandler(canonicalizer, credentials, resourceAccountName); }