Prerequisites
Install the Required Software
Download the following software before you evaluate ForgeRock IoT, and test the examples:
Get the Examples
To download the examples, clone the iot-edge
Git repository:
git clone https://github.com/ForgeRock/iot-edge.git
This command creates a directory named iot-edge
. Change to that directory:
cd /path/to/iot-edge
The examples assume that this is your current working directory.
Install and Configure AM
Read the ForgeRock® Access Management (AM) Evaluation Guide to set up an AM instance, with a default configuration.
The examples in this guide assume the following:
AM is installed with the fully qualified domain name
am.localtest.me
, in a Tomcat container, listening on port8080
.To configure AM, navigate to
http://am.localtest.me:8080/openam/
.AM is configured with the Default Configuration, with user
amAdmin
and passwordchangeit
.
Log in to AM as user
amAdmin
with passwordchangeit
.Add an IoT service.
The IoT service configures the identity store, adding the required Thing attributes to AM users (for all LDAPv3ForOpenDS and LDAPv3ForForgeRockIAM stores in the realm). For more information about this service, see IoT Service in the AM Reference:
In the Top Level Realm, select Services.
Click Add a Service, select IoT Service, and click .
Enable Create OAuth 2.0 Client.
The IoT service creates an OAuth 2.0 Client with the given name and default configuration required to serve as the client for this service. The client is created without any scope(s), and is used by default for all Things that request access tokens.
If a Thing (or group of Things) needs a client with different configuration to the default, you can create a custom client here, and add its name to the Thing’s
thingOAuth2ClientName
profile attribute.Enable Create OAuth 2.0 JWT Issuer.
The service creates a Trusted JWT Issuer with the given name and default configuration required for the IoT Service to act as the Issuer when handling requests for access tokens.
If you configure the client manually, the JWT issuer must have the following settings:
JWT Issuer: forgerock-iot-service
Consented Scopes Claim: scope
Resource Owner Identity Claim: sub
The signing/verification key used by this issuer is configured in the secrets store under
am.services.iot.jwt.issuer.signing
. It must use the HS256 algorithm.Click
.
Add an OAuth2 Provider service:
Select Services.
Click Add a Service, select OAuth2 Provider, and click .
If your service will use the introspection feature of the SDK, change the following settings:
On the Core tab, enable Use Client-Based Access & Refresh Tokens.
On the Advanced tab, select an asymmetric key for the OAuth2 Token Signing Algorithm.
Configure the IoT OAuth 2.0 client:
Select Applications > OAuth 2.0 > Clients.
Click on forgerock-iot-oauth2-client.
In the Scope(s) field, type
publish
.Click
.
If you create your own OAUth2 client here, make sure that the client contains the
JWT Bearer
grant type and has a strong generated password.Create two authentication trees:
Select Authentication > Trees > Create Tree.
Type
auth-tree
in the Name field, and click .Add an
Authenticate Thing
node and click .
Select Authentication > Trees > Create Tree.
Type
reg-tree
in the Name field, and click .Add an
Authenticate Thing
node and aRegister Thing
node.On the
Register Thing
node, enable Create Identity, then click .
Add a secret ID mapping.
Select Configure > Secret Stores and click on the
default-keystore
.On the Mappings tab, click .
In the Secret ID list, select
am.services.iot.cert.verification
, and in the Alias field, typees256test
then click .This mapping indicates which key the Register Thing node should use when verifying the registration certificate. The CA certificate in this example (
es256test
) is one of the test certificates included by default in AM.Click
to add the mapping.
For more information about mapping secret IDs, see Mapping and Rotating Secrets in the AM Security Guide.