Device Authorization and Authentication
The client authorization logic cross-checks the metadata provided by the connecting device through its client certificate with the resources the connecting device is trying to access.
-
The instanceId included in the certificate must match the ID of the instance to which the IoT Gateway belongs.
-
The deviceAlternateId included in the certificate must match the ID of the instance to which the IoT Gateway belongs.
-
The deviceAlternateId included in the certificate must match the MQTT clientId retrieved from the MQTT metadata. This constraint can be relaxed in case the connecting device has the authorization type router, as described in section Connection as a Router Device.
-
The topic to which the measurement data is published must match the structure that is defined for the data ingestion topic. For more information, please refer to section Measure Message Format (JSON).
-
The deviceAlternateId included in the certificate must match the alternateId value that is specified in the measure ingestion topic.
-
The target topic must match the structure that is defined for the command topic. For more information, please refer to section Command Message Format (JSON).
-
The deviceAlternateId included in the certificate must match the alternateId value that is specified in the command topic.
Connection as a Router Device
If the device has the authorization type router, it is allowed to send data and subscribe to the command topic on behalf of another device managed by the same gateway.
In this case, use the certificate of the router device. In the payload, use the device Alternate ID, capability Alternate ID, and sensor Alternate ID of the other device that you want to send measures to. For more information, please refer to the tutorial Create a Device Model using API.
If the authorization type is router, the match between the deviceAlternateId and the MQTT clientId is not enforced. This allows a router device to connect using any value for the MQTT clientId.
Certificate Structure
CN=deviceAlternateId:<…>|gatewayId:<…>|tenantId:<…>|instanceId:<…>The deviceAlternateId represents the alternate ID of the targeted device and the instanceId represents the ID associated with Device Connectivity instance that the IoT Gateway Cloud belongs to.