Closed sirknightj closed 1 year ago
Marking as draft. When copying the changes over to https://github.com/aws-samples/amazon-kinesis-video-streams-demos/tree/master/sigv4-signing, the exact same generated URL results in a 403. Need some time to look into possible issues with the Tyrus websocket client.
Ideas:
The issue is most likely a change with the Tyrus WebSocket client in the different versions of Tyrus we are using. In the maven project version, we are using Tyrus 1.15, and that fails every time. Bumping the version to the same as in Android (1.20), it works every time. I also tried with every version in between (1.16, 1.17, 1.18, and 1.19), it does not work.
In the release notes, I see this: https://github.com/eclipse-ee4j/tyrus/releases/tag/1.20, so that's probably what's causing it.
What was changed, why was it changed, and how was it changed?
dateMilli
provider (i.e.new Date().getTime()
) from inside of thesign
method, to become a parameter for testability.sign()
method. SincewssUri
will always be the first part ofuri
, it's just passing in a redundant extra parameter.URL Encoding
We now single url-encode the query parameters. The URI constructor encodes non-url-safe characters in the 4th argument (signedCanonicalQueryString). This 4th argument is already URL-encoded, so it will do it a 2nd time. This does not affect the Tyrus Websocket client that we are currently using, as it is able to handle this case. However, other websocket clients, such as the ones in the browser, and
wscat
cannot.Previous:
Now:
Testing
wscat
to ensure it can connect there as well.By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.