In the Azure Internet of Things environment, when trying to connect any devices that cannot support the usage of Microsoft's reference architecture protocol translation is recommended.
I have implemented a translation gateway that multiplexes connections, and functions similar to this implementation that uses the "device connect" access policy to send messages to the Cloud IoT Hub as whatever device, over a single AMQP connection. As an example the messages are sent over the following link '/devices/' + deviceIdentifier + '/messages/events';
This is completely functional for a connection formed by device -> my middleware -> Cloud IoT Hub
and for the reverse direction. I would like to implement the same with the introduction of a transparent gateway, that is device -> my middleware -> Edge IoT Hub -> Cloud IoT Hub
My issue arises from the Edge Hub seemingly not accepting the "device connect" access policy key.
As authentication I am building a SharedAccessSignature
as can be seen on the example repository and below, however as far as I can tell unlike SharedAccessKeyAuthenticationProvider.fromConnectionString
there is no way to specify the gatewayHostName.
this.sas = SharedAccessSignature.create(
encodeURIComponent(this.endpoint), this.keyName, this.key,
Math.ceil((Date.now() / 1000) + this.KEY_TIMEOUT)
);
In short, I am trying to have my middleware "impersonate" any of the devices on the hub, over a single TLS connection, using the "device connect" access policy key, through a Transparent IoT Edge Gateway, however I see no place to specify the gatewayHostName
parameter on a SharedAccessSignature or find a way to find and configure IoT hub-level shared access policies on a IoT Edge hub.