mghoneimy/php-graphql-client

AWS IAM Signed Requests

Closed this issue · 2 comments

Hey,
I'm asking myself if it would make sense to add the possibility to utilize AWS IAM signed requests in this package (optional).

I have a project currently where the authorization needs to happen with AWS SignatureV4 signing

Hey @chnshure ,
I spent some time looking at the AWS SignatureV4 signing process to validate if this should be part of the package (reference here: https://github.com/aws/aws-sdk-php/blob/master/src/Signature/SignatureV4.php#L78)

After examining the code it doesn't feel like this is something I'd want implement in the package, and I don't want to require the aws-dsk-php package in the project, it's not part of the GraphQL request building by any means.

That being said, I see your problem and I think that other people might face similar issues since AWS is a huge platform. I think that there are number of ways to address this issue:

  1. Provide a generic way for the client to alter the request before sending it to the GraphQL server. Regardless of the type of alteration, be it signing the request or any other type of modifications to the request. One way to implement this is to provide a way to add middlewares to the client that would invoke functions that modify the request before sending it to the server, but there sure are other ways.
  2. Fork this package, require the aws-sdk-php packe and add the AWS signing part to requests in your forked version
  3. Create a new package (aws-graphql maybe) that requires both this package and the aws-sdk-package and create a class that generates the Request object from the GraphQL request and then send it using the AWS PHP package, which would automatically sign it.

Open to hearing your thoughts about this.

Hey @mghoneimy
thanks for the reply and for looking into it.
After looking into it I also thought it might make more sense to not include this into this package directly. However I've forked your repo already and implemented it (quick 'n dirty) cause I needed it for AWS.
Unfortunately the SDK doesn't offer queries/mutations with GraphQL API's out of the box and I'm also a huge fan of this package. However I think this can be closed for now.

Greetings