Closed oharaandrew314 closed 10 months ago
It's very possible - I'm sure we've done it before as a filter and using the signing we've already got in the Aws module of the core.
It seems to me the biggest/only difference between a signed request and pre-signed request is that in a pre-signed request you can customize the validity duration of the signature. If I can find the documentation (or reverse-engineer one of the SDKs) I should be able to come up with an extension to the AwsSignatureV4Signer
to add the additional properties.
I think all I need to do is add the X-Amz-Expires
header to the canonical request, and the AwsSignatureV4Signer
should work out of the box.
I'm tantalizingly close. I'm no longer getting SignatureDoesNotMatch
, but now I'm getting AccessDenied
, which is frustratingly vague.
Bingo. I've made a PR in the main http4k repo to add a common pre-signer.
Closing as releasing in main http4k-aws module
I was going to make an additional helper in this repo, but now that it's possible with the main module, you can close this if you want.
Intersting - how did you envisage that helper being used?
Something like
fun S3Bucket.presign(action: S3BucketAction<*>): PresignedRequest
so you could do
val s3Bucket = S3Bucket.Http("foo", "ca-central-1")
val signed = s3Bucket.presign(GetObject("foo.txt"))
ok - sounds good. If you can do it I'll hold off on the connect release until it's donr
Timing for me will be tight, but I'll try to have it done by your next morning. If not, I'll be AFK for a week, so you should release without it.
don;t worry actually - there's nothing else to go in so will hold off :)
This now depends on https://github.com/http4k/http4k/pull/1015
we're now running with that latest http4k which has that change in it you need 😄
Merged and awaiting release.
It would be nice to have some sort of amazon presigner; particularly for S3 GET and PUT.