/// <summary> /// Azure URI /// </summary> /// <param name="fileName">file name</param> /// <param name="container">container</param> /// <returns>Full Uri</returns> public SignedUrl GetSignedUrl(string fileName, string container) { // Create the blob client object. CloudBlobClient blobClient = GetBlobClient(storageConnectionString); // Get a reference to a container to use for the sample code, and create it if it does not exist. string rootContainer = this.GetRootContainer(container); CloudBlobContainer blobContainer = blobClient.GetContainerReference(rootContainer); blobContainer.CreateIfNotExists(); SharedAccessBlobPolicy sasConstraints = new SharedAccessBlobPolicy(); int expireTime = int.Parse(azureExpireTime, CultureInfo.CurrentCulture); sasConstraints.SharedAccessExpiryTime = DateTime.UtcNow.AddMinutes(expireTime); sasConstraints.Permissions = SharedAccessBlobPermissions.Read | SharedAccessBlobPermissions.Write | SharedAccessBlobPermissions.List; // Generate the shared access signature on the container, setting the constraints directly on the signature. string sasContainerToken = blobContainer.GetSharedAccessSignature(sasConstraints); // Return the URI string for the container, including the SAS token SignedUrl config = new SignedUrl(); config.Container = rootContainer; config.Url = blobContainer.Uri.ToString() + "/" + fileName + sasContainerToken; return(config); }
/// <summary> /// Amazon URI /// </summary> /// <param name="fileName">file name</param> /// <param name="container">container</param> /// <returns>Full Uri</returns> public SignedUrl GetSignedUrl(string fileName, string container) { AmazonCloud signer = GetSigner(region, bucket, fileName); SignedUrl config = new SignedUrl(); string policy = GetAwsPolicy(bucket, fileName); string signature = GetAwsSignature(signer, policy, accessKeyId, secretKey); config.Url = "https://" + bucket + ".s3.amazonaws.com/" + fileName + "?" + signature; return(config); }
public override int GetHashCode() { int hash = 1; if (Status != 0) { hash ^= Status.GetHashCode(); } if (SignedUrl.Length != 0) { hash ^= SignedUrl.GetHashCode(); } if (SupportingImageSignedUrl.Length != 0) { hash ^= SupportingImageSignedUrl.GetHashCode(); } if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }