Open
Description
Describe the bug
AwsIotMqttConnectionConfigBuilder.with_custom_authorizer()
is broken, signing isn't required for custom authorizers, yet it enforces it.
Expected Behavior
Using with_custom_authorizer()
with only the authorizer_name
, token_key_name
, and token_value
successfully builds a configuration.
Current Behavior
Using with_custom_authorizer()
with only the authorizer_name
, token_key_name
, and token_value
throws error Signing-based custom authentication requires all token-related properties to be set
.
Reproduction Steps
const { iot } = require('aws-crt');
iot.AwsIotMqttConnectionConfigBuilder.new_default_builder()
.with_custom_authorizer(null, 'test-authorizer', null, null, 'x-api-key', '1234')
.build();
Possible Solution
Change
aws-crt-nodejs/lib/common/aws_iot_shared.ts
Lines 85 to 93 in d1729bf
if (is_string_and_not_empty(input_signature) && input_signature) {
if (!is_string_and_not_empty(input_token_value) || !is_string_and_not_empty(input_token_key_name)) {
throw new Error("Signing-based custom authentication requires all token-related properties to be set");
}
username_string = add_to_username_parameter(username_string, input_signature, "x-amz-customauthorizer-signature=");
}
Additional Information/Context
No response
aws-crt-nodejs version used
1.21.0
nodejs version used
v20.10.0
Operating System and version
Ubuntu 22.04.3 LTS