You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by "Biswa Ranjan Ray (JIRA)" <ji...@apache.org> on 2019/03/11 08:51:00 UTC

[jira] [Commented] (JCLOUDS-1428) Support for SAS token based Authentication for Azure Blob Storage

    [ https://issues.apache.org/jira/browse/JCLOUDS-1428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16789302#comment-16789302 ] 

Biswa Ranjan Ray commented on JCLOUDS-1428:
-------------------------------------------

Hi,

I'm trying to configure BlobStoreContext for Azure storage using SAS token. I found the below code snippet from [jclouds |https://jclouds.apache.org/guides/azure-storage/]site that offers the portable BlobStore api:

{code:java}

BlobStoreContext context = ContextBuilder.newBuilder("azureblob")
 .credentials(storageAccountName, sasToken) //using sasToken in place of storage key
 .buildView(BlobStoreContext.class);

{code}
 Since we use SAS token based authentication, so I used sasToken in place of storageKey in the above code. But this throws : *com.google.common.io.BaseEncoding$DecodingException: Invalid input length 121*
 Please find the full stack trace attached for your reference.

I could be wrong, but after following the test class [SharedKeyLiteAuthenticationTest.java|https://gitbox.apache.org/repos/asf?p=jclouds.git;a=blob;f=providers/azureblob/src/test/java/org/jclouds/azure/storage/filters/SharedKeyLiteAuthenticationTest.java;h=5e0c2264127a2665c70391f010c6031fabe27854;hb=0ce9261] which was committed as a part of the [PR|https://gitbox.apache.org/repos/asf?p=jclouds.git;h=0ce9261], I tried the below code of my own:
{code:java}
BlobStoreContext context = ContextBuilder.newBuilder("azureblob")
                   .endpoint("https://${identity}.blob.core.windows.net")
                   .credentials(accountName, sasToken)
                   .modules(new ArrayList<>(3)) //just added an empty list of size 3
                   .buildInjector()
                   .getInstance(BlobStoreContext.class);

{code}

The above code also throws the same exception. 
Is it right to use SAS token as credential in place of storage key ?
Is it possible to use SAS token to configure BlobStoreContext for azure in order to get the portable BlobStore ? 
A code snippet would be highly appreciated.

Thanks and Regards,
Biswa Ranjan Ray

> Support for SAS token based Authentication for Azure Blob Storage
> -----------------------------------------------------------------
>
>                 Key: JCLOUDS-1428
>                 URL: https://issues.apache.org/jira/browse/JCLOUDS-1428
>             Project: jclouds
>          Issue Type: Improvement
>          Components: jclouds-blobstore
>            Reporter: Himanshu Jain
>            Priority: Major
>              Labels: azureblob
>             Fix For: 2.2.0, 2.1.3
>
>
> Hi,
> We have one use case where we want to provide limited access to objects in our storage accounts. We figured that the best way to do  this is by using SAS token based authentication mechanism to upload/download objects to Azure Blob Storage - [SAS based Authentication|https://docs.microsoft.com/en-us/azure/storage/common/storage-dotnet-shared-access-signature-part-1]
> We found that JClouds client library provides support for Azure Blob Storage using account keys which might not fit our use case because of security reasons.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)