In production it is expected to have own OAuth server where you create OAuth client for DPS that support client credential flow. In this case you need add append OAuth client configuration to the global.oauth.device section:
This section provides instructions on how to integrate with the KeyCloak OAuth server. The integration involves configuring the DPS OAuth client and the WWW OAuth client to use the same value for the <OWNER_CLAIM> claim. By following these steps, you will ensure that the appropriate user is identified as the owner of DPS devices.
To begin, you need to locate the user id within the KeyCloak OAuth server. This user will be designated as the owner of the DPS devices. Once you have obtained the user id, you will substitute <OWNER> with this value in the subsequent instructions.
Note
At the end of the integration process, you will establish a connection between the OAuth DPS client and the user. By default, the association is based on the <OWNER_CLAIM> value. However, if you wish to change this behavior, you have the option to create a custom mapper.
To create a custom mapper, you can define a specific logic that sets the <OWNER_CLAIM> to the appropriate value for your requirements. This allows you to tailor the association between the user and the OAuth DPS client according to your specific needs.
In the process of acquiring a device access token from the OAuth server, the Device Provisioning Service incorporates a query parameter in the request called <OWNER_CLAIM>=<OWNER>. This parameter specifies the desired <OWNER_CLAIM> value to be associated with the access token.
Create an OAuth client for DPS in KeyCloak with the following configuration:
Settings:
Enabled: On
Client Protocol: openid-connect
Access Type: confidential
Service Accounts Enabled: On
Authorization Enabled: On
Credentials:
Client Authenticator: Client Id and Secret
Secret: <MY_DPS_CLIENT_SECRET>
Mapper:
Create a custom Hardcoded claim mapper:
Token Claim Name: <OWNER_CLAIM>
Claim value: <OWNER>
Claim JSON Type: String
Add to access token: On
Add to userinfo: On
Create a WWW OAuth client with a mapper that adds the <OWNER_CLAIM> claim to the user JWT token. You can use the User Property mapper with the following configuration to map the id property to the <OWNER_CLAIM> claim:
Make sure to replace <KEYCLOAK_REALM_ADDRESS>, <OWNER_CLAIM>, <OWNER>, <MY_DPS_CLIENT_ID>, and <MY_DPS_CLIENT_SECRET> with the appropriate values for your setup.
where ca.crt is the CA certificate, tls.crt is the client certificate and tls.key is the client private key. Then you need add extraVolume and extraVolumeMounts to the deviceProvisioningService section v: