Error when running test-invoke-authorizer: tokenSignature

0

I am attempting to create a custom authorizer for IoT and am following this guide:
https://aws.amazon.com/blogs/security/how-to-use-your-own-identity-and-access-management-systems-to-control-access-to-aws-iot-resources/

When I attempt to test my authorizer with this command:
aws iot test-invoke-authorizer --authorizer-name <authorizer_name> --token allow --token-signature <token_signature>

I get the response:
An error occurred (InvalidRequestException) when calling the TestInvokeAuthorizer operation: 1 validation error detected: Value '<signature here>' at 'tokenSignature' failed to satisfy constraint: Member must satisfy regular expression pattern: [A-Za-z0-9_/]_={0,2}

I am testing it in Centos, and have created a bash script like this:
#!/bin/bash
sig=cat token.sign.b64
aws iot test-invoke-authorizer --authorizer-name MyAuthorizer --token allow --token-signature "$sig"

The token.sign.b64 is created as per the instructions in the guide.

How do I get it to authorize correctly?

tobyjo
質問済み 5年前489ビュー
1回答
0

I found the answer myself.

Running
od -c token.sign.b64
to view the actual byte contents of the file showed that it had \n chars in it which would have been generating the error.

So instead of just running base64 on the file I ran this to ensure that no \n got into the output file:
base64 token.sign | tr -d \n > token.sign.b64

tobyjo
回答済み 5年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ