I can confirm that the aws-s3 provider still uses the v2 signatures.  I
committed several fixes for the v4 signatures in JCLOUDS-766 but one
blocking issue remains.  v4 URL signing requires a content hash for the
server to accept the PUT request but the jclouds API does not allow for
this.  One workaround would be to use v2 signatures for jclouds URL
signing and v4 signatures for other requests, which would work for most
regions.  If you can live without this functionality, please use the
following branch for now:

https://github.com/andrewgaul/jclouds/tree/aws-signature-v4

Unfortunately I cannot work on this further for a few weeks.  Let's
track further discussion with JCLOUDS-1090.

On Wed, Mar 09, 2016 at 11:57:53PM +0530, Ranjith R wrote:
> Hi,
>        I would also like to know how to use AWS S3 v4 signature for
> authentication.  Is there way to specify which signature version to use
> while constructing a BlobStoreContext?
> 
> Thanks in advance,
> Ranjith
> 
> On Tue, Mar 8, 2016 at 3:24 PM, Archana C <carchan...@yahoo.co.uk> wrote:
> 
> > From the amazon documentation, we understand that the region eu-central-1
> > (Frankfurt) supports only AWS signature version 4, and from
> > https://issues.apache.org/jira/browse/JCLOUDS-480 we understand the
> > jclouds already has the support added for version 4 signature.
> >
> > What we are trying to figure out is *if* we need to do anything from the
> > client side to change the authorization signature.  We were hoping the
> > BlobStore APIs might work it used to with out changing the client code,
> > however, we see the requests sent are using V2 signature, and the server is
> > rejecting them.
> >
> > 2016-03-08 14:57:57,044 DEBUG [jclouds.wire] [main] >> "Test[\n]"
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> PUT
> > https://testcontainer3.s3-eu-central-1.amazonaws.com/file1 HTTP/1.1
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Expect:
> > 100-continue
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Host: 
> > *testcontainer3.s3-eu-central-1.amazonaws.com
> > <http://testcontainer3.s3-eu-central-1.amazonaws.com/>*
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Date: Tue, 08
> > Mar 2016 09:27:50 GMT
> > *2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Authorization:
> > AWS AKIAISCW6DRRITWR6IWQ:6AndVHQV2w75OXQDq/9sWt37KN0=*
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Content-Type:
> > application/unknown
> > 2016-03-08 14:57:57,045 DEBUG [jclouds.headers] [main] >> Content-Length: 5
> >
> > *org.jclouds.http.HttpResponseException: Server rejected operation
> > connecting to PUT
> > https://testcontainer3.s3-eu-central-1.amazonaws.com/file1
> > <https://testcontainer3.s3-eu-central-1.amazonaws.com/file1> HTTP/1.1*
> > * at
> > org.jclouds.http.internal.BaseHttpCommandExecutorService.invoke(BaseHttpCommandExecutorService.java:118)*
> > * at
> > org.jclouds.rest.internal.InvokeHttpMethod.invoke(InvokeHttpMethod.java:90)*
> > * at
> > org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:73)*
> > * at
> > org.jclouds.rest.internal.InvokeHttpMethod.apply(InvokeHttpMethod.java:44)*
> >
> > *Any help on how to use the AWS version 4 signature for the blobstore APIs
> > will be much appreciated. *
> >
> > *NB: With the last commit mentioned in the above reply, we do not see the
> > region not supported exception anymore. *
> >
> > *Thanks!*
> >
> > *Regards*
> >
> > *Archana*
> > <https://uk-mg42.mail.yahoo.com/neo/launch?.rand=6ppet36ik2beh#>
> >
> >
> > On Tuesday, 8 March 2016, 10:54, Andrew Gaul <g...@apache.org> wrote:
> >
> >
> > Please test again with the latest master which includes a fix:
> >
> > https://git-wip-us.apache.org/repos/asf?p=jclouds.git;a=commit;h=c18371a7
> >
> > On Mon, Mar 07, 2016 at 12:29:59PM +0000, Archana C wrote:
> > > public class App
> > > {
> > >     public static void main( String[] args ) throws IOException
> > >     {
> > >         // TODO Auto-generated method stub
> > >                 // TODO Auto-generated method stub
> > >                 String containername = "archanatrial12";
> > >                 String objectname = "object1";
> > >                 String tempFile =
> > "/home/archana/Eclipse/trialV42/src/main/java/trialV41/trialV42/result.txt";
> > >                 //int length;
> > >
> > >                 // s3.amazonaws.com   s3.eu-central-1.amazonaws.com
> > s3-external-1.amazonaws.com
> > >
> > >             BlobStoreContext context =
> > ContextBuilder.newBuilder("aws-s3")
> > >                         .credentials("XXXXXXXXXXX",
> > "YYYYYYYYYYYYYYYYYYY")
> > >                         .buildView(BlobStoreContext.class);
> > >
> > >                 // Access the BlobStore
> > >                 BlobStore blobStore = context.getBlobStore();
> > >                 //Location loc = "us-east-1";
> > >                 Location loc = new
> > LocationBuilder().scope(LocationScope.REGION)
> > >                         .id("eu-central-1")
> > >                         .description("region")
> > >                         .build();
> > >
> > >                 // Create a Container
> > >                 blobStore.createContainerInLocation(loc, containername);
> > >
> > >                 // Create a Blob
> > >                 File input = new
> > File("/home/archana/Eclipse/jclouds1/src/main/java/jclouds1/sample.txt");
> > >                 long length = input.length();
> > >                 // Add a Blob
> > >                 Blob blob =
> > blobStore.blobBuilder(objectname).payload(Files.asByteSource(input)).contentLength(length)
> > >                         .contentDisposition(objectname).build();
> > >
> > >                 // Upload the Blob
> > >                 String eTag = blobStore.putBlob(containername, blob);
> > >                 System.out.println(eTag);}}
> > > Error  : requested location eu-central-1, which is not in the configured
> > locations
> > > Solution to rectify the issue required
> > >
> > > RegardsArchana
> >
> >
> > --
> > Andrew Gaul
> > http://gaul.org/
> >
> >
> >
> >

-- 
Andrew Gaul
http://gaul.org/

Reply via email to