@Test
  public void testSigning()
      throws IOException, URISyntaxException, StorageException, InvalidKeyException {
    CloudBlobContainer container = binaryManager.container;
    Binary binary = binaryManager.getBinary(Blobs.createBlob(CONTENT));
    assertNotNull(binary);

    CloudBlockBlob blockBlobReference = container.getBlockBlobReference(CONTENT_MD5);
    SharedAccessBlobPolicy policy = new SharedAccessBlobPolicy();
    policy.setPermissionsFromString("r");

    // rscd content-dispositoon
    // rsct content-type

    Instant endDateTime =
        LocalDateTime.now().plusHours(1).atZone(ZoneId.systemDefault()).toInstant();
    policy.setSharedAccessExpiryTime(Date.from(endDateTime));

    SharedAccessBlobHeaders headers = new SharedAccessBlobHeaders();
    headers.setContentDisposition("attachment; filename=\"blabla.txt\"");
    headers.setContentType("text/plain");

    String something = blockBlobReference.generateSharedAccessSignature(policy, headers, null);
    System.out.println(something);

    CloudBlockBlob blob =
        new CloudBlockBlob(
            blockBlobReference.getUri(), new StorageCredentialsSharedAccessSignature(something));

    System.out.println(blob.getQualifiedUri());
  }
 /**
  * Custom processor
  *
  * <p>{@sample.xml ../../../doc/azure-blob-service-connector.xml.sample
  * azure-blog-service:downloadBlob}
  *
  * @param friend Name to be used to generate a greeting message.
  * @return A greeting message
  * @throws StorageException
  * @throws URISyntaxException
  */
 @Processor
 public InputStream downloadBlob(String container, String fileName) throws Exception {
   CloudBlobContainer blobContainer =
       this.config.getServiceClient().getContainerReference(container);
   CloudBlockBlob blob = blobContainer.getBlockBlobReference(fileName);
   return blob.openInputStream();
 }
  /**
   * {@sample.xml ../../../doc/azure-blob-service-connector.xml.sample
   * azure-blog-service:downloadBlob}
   *
   * @param friend Name to be used to generate a greeting message.
   * @return A greeting message
   * @throws StorageException
   * @throws URISyntaxException
   */
  @Processor
  public void uploadBlobFromPath(String container, String fileName, String path) throws Exception {
    BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
    containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);

    CloudBlobContainer blobContainer =
        this.config.getServiceClient().getContainerReference(container);
    blobContainer.createIfNotExists();
    blobContainer.uploadPermissions(containerPermissions);

    CloudBlockBlob blob = blobContainer.getBlockBlobReference(fileName);
    blob.uploadFromFile(path);
  }
  /**
   * {@sample.xml ../../../doc/azure-blob-service-connector.xml.sample
   * azure-blog-service:downloadBlob}
   *
   * @param friend Name to be used to generate a greeting message.
   * @return A greeting message
   * @throws StorageException
   * @throws URISyntaxException
   */
  @Processor
  public void uploadBlob(String container, String fileName, InputStream fileStream)
      throws Exception {
    BlobContainerPermissions containerPermissions = new BlobContainerPermissions();
    containerPermissions.setPublicAccess(BlobContainerPublicAccessType.CONTAINER);

    CloudBlobContainer blobContainer =
        this.config.getServiceClient().getContainerReference(container);
    blobContainer.createIfNotExists();
    blobContainer.uploadPermissions(containerPermissions);

    CloudBlockBlob blob = blobContainer.getBlockBlobReference(fileName);
    blob.uploadText(IOUtils.toString(fileStream, "UTF-8"));
  }