Skip to content

support for authentification using temporary session tokens#99

Open
jrochel wants to merge 2 commits into
inhabitedtype:masterfrom
jrochel:tokens
Open

support for authentification using temporary session tokens#99
jrochel wants to merge 2 commits into
inhabitedtype:masterfrom
jrochel:tokens

Conversation

@jrochel

@jrochel jrochel commented Mar 4, 2021

Copy link
Copy Markdown

Note that depending on which service one uses, the token needs to be
added either before or after signing.

https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html

« When you add the X-Amz-Security-Token parameter to the query string, some services require that you include this parameter in the canonical (signed) request. For other services, you add this parameter at the end, after you calculate the signature. For details, see the API reference documentation for that service. »

@vouillon

vouillon commented Mar 4, 2021

Copy link
Copy Markdown

Note that depending on which service one uses, the token needs to be
added either before or after signing.

https://docs.aws.amazon.com/general/latest/gr/sigv4-add-signature-to-request.html

« When you add the X-Amz-Security-Token parameter to the query string, some services require that you include this parameter in the canonical (signed) request. For other services, you add this parameter at the end, after you calculate the signature. For details, see the API reference documentation for that service. »

Since the parameter is added to the headers, not the query string, I think it should always be added before signing.

@jrochel

jrochel commented Mar 4, 2021

Copy link
Copy Markdown
Author

Maybe there is a mistake in by session_token_signed implementation, but if I use it instead of session_token_unsigned I'm getting a InvalidClientTokenId with cloudformation. And your statement would contradict

Note that depending on which service one uses, the token needs to be
added either before or after signing.

Or am I simply misunderstanding this statement?

@vouillon

vouillon commented Mar 4, 2021

Copy link
Copy Markdown

Indeed, you forgot to add the X-Amz-Security-Token header.

It seems you only need to add the token after signing when generating a pre-signed URL for an AWS IoT websocket. See aws/aws-sdk-go#2485 (comment).

@jrochel jrochel force-pushed the tokens branch 2 times, most recently from bee5ae1 to 69a47ff Compare March 23, 2021 23:59
@vouillon

Copy link
Copy Markdown

How does it compare to #95?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants