Code Monkey home page Code Monkey logo

examples's Introduction

Examples

JavaQuery Examples

examples's People

Contributors

javaquery avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

examples's Issues

aws sigv4 not working with iot endpoint

Hello,

i am having trouble with signature of aws canonical request, using your util
i am trying to make a post call for the iot endpoint
https://**-ats.iot.us-east-1.amazonaws.com/topics/test?qos=0
same req was working with postman client

   TreeMap<String, String> awsHeaders = new TreeMap<String, String>();
    awsHeaders.put("host", "***-ats.iot.us-east-1.amazonaws.com");
   TreeMap<String, String> awsQueryParam = new TreeMap<>();
    awsQueryParam.put("qos", "0");

    AWSV4Auth aWSV4Auth = new AWSV4Auth.Builder(accessKey, secretKey)
                            .regionName("us-east-1")
                            .serviceName("iotdata") // es - elastic search. use your service name
                            .httpMethodName("POST") //GET, PUT, POST, DELETE, etc...
                            .canonicalURI("topics/test") //end point
                            .queryParametes(awsQueryParam) //query parameters if any
                            .awsHeaders(awsHeaders) //aws header parameters
                            .payload(payload) // payload if any
                            .debug() // turn on the debug mode
                            .build();

but getting signature error

Client error <403 FORBIDDEN Forbidden,{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation for details.","traceId":"80e40ad7-9db1-7a60-809a-889c9fecb852"},[date:"Mon, 11 Feb 2019 20:57:32 GMT", x-amzn-ErrorType:"ForbiddenException:", x-amzn-RequestId:"80e40ad7-9db1-7a60-809a-889c9fecb852", connection:"keep-alive", content-type:"application/json", content-length:"241"]>

let me know if i am doing anything wrong

Thank you,

X-Amz-Content-Sha256 not handled

When I Post data to S3, I must to send X-Amz-Content-Sha256 header.
In AWSV4Auth.java there isn't this business logic.

I tried to change source code, but I receive the following error message:

<Error><Code>XAmzContentSHA256Mismatch</Code><Message>The Content-SHA256 you specified did not match what we received</Message><Resource>bucket_prova1/filedaStandalone9.txt</Resource><RequestId>0c07c835:16b79321460:646d:60a</RequestId></Error>

AWSV4Auth.zip

Licensing

Hi @javaquery

I came across your AWS signing example today but there's no licensing information attached to it. Can you add a license to it, please, so we can know if we're allowed to use it?

Cheers,

-James

AWS was not able to validate the provided access credentials

Hi ,
I am trying to do GET requests such as describe images or describe regions using this URI
https://ec2.us-east-1.amazonaws.com/?Action=DescribeImages&Version=2016-11-15

I have given everything correctly , my canonical url is

GET
/
Action=DescribeImages&Version=2016-11-15
content-type:application/x-www-form-urlencoded; charset=utf-8
host:ec2.amazonaws.com
x-amz-date:20170629T132328Z

content-type;host;x-amz-date
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855

and my String to sign is

AWS4-HMAC-SHA256
20170629T132328Z
20170629/us-east-1/ec2/aws4_request
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

the headers are ,
x-amz-date : 20170629T132328Z
Authorization : AWS4-HMAC-SHA256 Credential=AbCdEfGhIjKASDFWER/20170629/us-east-1/ec2/aws4_request,SignedHeaders=content-type;host;x-amz-date,Signature=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
host : ec2.amazonaws.com
content-type : application/x-www-form-urlencoded; charset=utf-8

and I am always getting this error

AuthFailureAWS was not able to validate the provided access credentialsdcbsjdhbvjshdvbjhsbdvjhbsdcjhb

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.