Authenticate the Gateway With Dynamic Registration

This example registers an identity for the Gateway, then starts the Gateway, and authenticates it. The Gateway must have an asymmetric key pair for signing, and a CA-signed X.509 certificate that contains the key pair's public key. This is provided in the /path/to/iot-edge/examples/resources directory. The source code for this example is in /path/to/iot-edge/cmd/gateway/main.go:

  1. Start the Gateway:

    cd /path/to/iot-edge
    ./run.sh gateway \
    --name "dynamic-gateway" \
    --url "http://am.localtest.me:8080/openam" \
    --audience "/" \
    --realm "/" \
    --tree "reg-tree" \
    --key "./examples/resources/eckey1.key.pem" \
    --cert "./examples/resources/dynamic-gateway.cert.pem" \
    --address ":5683" \
    --debug
    commandline options
    	url: http://am.localtest.me:8080/openam
    	realm: /
    	tree: reg-tree
    	name: dynamic-gateway
    	address: :5683
    	key: ./examples/resources/eckey1.key.pem
    	kid:
    	certificate: ./examples/resources/dynamic-gateway.cert.pem
    	timeout 5s
    	debug: true
    IoT Gateway server started.

    The Gateway is now registered, with the ID dynamic-gateway, and has started and authenticated itself to AM.

  2. In a separate terminal window, connect a Thing to the Gateway.

  3. To stop the gateway process, press Ctrl+C in the terminal window where the process is running.

Read a different version of :