Authenticate a Thing After Manual Registration
This example authenticates a Thing and requests an access token for the Thing. The Thing must have an asymmetric key pair for signing. This is provided in the /path/to/iot-edge/examples/resources
directory. The source code for this example is in /path/to/iot-edge/examples/thing/simple/main.go
.
This sequence diagram shows how the Thing is authenticated for the session:
Before you run the example, register the Thing manually (using manual-thing
as the Thing's ID). Then, run the thing/simple
example:
cd /path/to/iot-edge ./run.sh example "thing/simple" \ -name "manual-thing" \ -url "http://am.localtest.me:8080/openam" \ -audience "/" \ -realm "/" \ -tree "auth-tree" \ -keyfile "./examples/resources/eckey1.key.pem"
Creating Thing manual-thing... Done Requesting access token... RequestAccessToken response: { "access_token":"iaZqWRyVBhGMLWwAOzDrOtKarfw", "scope":"publish", "token_type":"Bearer", "expires_in":3599} Done Access token: iaZqWRyVBhGMLWwAOzDrOtKarfw Expires in: 3599 Scope(s): [publish] ______ __ __ /\ __ \ /\ \/ / \ \ \/\ \ \ \ _"-. \ \_____\ \ \_\ \_\ \/_____/ \/_/\/_/
The Thing is now authenticated to AM and has received an access token.