Step 1. Hosting a Remote Consent Service
PingOne Advanced Identity Cloud PingAM
On PingOne Advanced Identity Cloud and PingAM, authorization requests carrying authorization_details must route through a Remote Consent Service (RCS), a web application that you host.
The authorization server’s native consent pages do not display authorization_details, so the RCS is the component that shows the user what they are approving.
This step shows you how to run a sample RCS application, which you can use to test a complete RAR flow.
The RCS contract is a signed JWT exchange: the authorization server sends the requested authorization_details to the RCS in a signed consent request JWT, and the RCS returns the user’s decision in a signed consent response JWT.
|
The sample RCS application is for demonstration and testing only. It does not encrypt consent requests, and does not validate the issuer or audience of the consent request. For production use, replace the sample RCS application with your own implementation of the RCS contract. |
Prerequisites
You need the following to run the sample RCS:
-
Node.js 18 or later.
-
mkcert, to create a locally-trusted certificate for the sample RCS.Install it with Homebrew:
brew install mkcert -
The local IP address of the machine running the sample RCS.
The sample apps and the emulator or simulator run on the same network as your machine, and they reach the sample RCS using this address.
Obtaining the local IP address
Complete the following steps to obtain your local IP address:
-
Windows
-
macOS
-
In a command prompt, enter
ipconfig /allWindows displays information about the network adapters in your computer.
Show example output
Windows IP Configuration Host Name . . . . . . . . . . . . : Windows Primary Dns Suffix . . . . . . . : Node Type . . . . . . . . . . . . : Hybrid IP Routing Enabled. . . . . . . . : No WINS Proxy Enabled. . . . . . . . : No Ethernet adapter Ethernet: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : E3100G 2.5 Gigabit Ethernet Controller Physical Address. . . . . . . . . : 74-34-E2-2b-30-44 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter Local Area Connection* 1: Media State . . . . . . . . . . . : Media disconnected Description . . . . . . . . . . . : Microsoft Wi-Fi Direct Virtual Adapter Physical Address. . . . . . . . . : 67-6C-EB-B3-46-82 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes Wireless LAN adapter Wi-Fi: Description . . . . . . . . . . . : Wireless Network Adapter (210NGW) Physical Address. . . . . . . . . : 87-6C-DF-C9-17-90 DHCP Enabled. . . . . . . . . . . : Yes Autoconfiguration Enabled . . . . : Yes IPv6 Address. . . . . . . . . . . : 2406:3d08:2f61:1400::2d47 Lease Obtained. . . . . . . . . . : January 27, 2025 11:09:26 AM Lease Expires . . . . . . . . . . : January 28, 2025 6:09:26 AM IPv6 Address. . . . . . . . . . . : 2406:3d08:2f61:1400::2d47 Temporary IPv6 Address. . . . . . : 2604:2b08:2f93:2600:b479:b5b4:25ff:acc8 Link-local IPv6 Address . . . . . : fe54::d9e5:16ff:d9d4:e22%10 IPv4 Address. . . . . . . . . . . : 192.168.0.35 Subnet Mask . . . . . . . . . . . : 255.255.255.0 Lease Obtained. . . . . . . . . . : January 27, 2025 11:09:24 AM Lease Expires . . . . . . . . . . : January 29, 2025 11:09:26 AM Default Gateway . . . . . . . . . : fe80::bb8:c0ee:fea5:8c58%10 192.168.0.1 DHCP Server . . . . . . . . . . . : 192.168.0.1 DHCPv6 IAID . . . . . . . . . . . : 893252287 DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-1b-87-59-2D-74-86-C4-3C-30-88 DNS Servers . . . . . . . . . . . : 2025:4e8:0:230b::11 2025:4e8:0:230c::11 8.8.8.8 NetBIOS over Tcpip. . . . . . . . : Enabled -
Ignoring adapters where the Media State property is listed as
Media Disconnected, locate the ethernet or wireless adapter that connects to your router. -
Make a note of the IPv4 Address field.
The address will often start with
192.168.,10.0., or172.16., which are the first digits of the commonly used reserved private IPv4 addresses.In this case, the local IPv4 IP address is
192.168.0.35.You will use this address to access your custom UI app for this tutorial.
-
In a terminal window, enter
ifconfigmacOS displays information about the network interfaces in your computer.
Show example output
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384 options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP> inet 127.0.0.1 netmask 0xff000000 inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 nd6 options=201<PERFORMNUD,DAD> gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280 stf0: flags=0<> mtu 1280 anpi0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=400<CHANNEL_IO> ether 22:d0:cb:e5:fd:09 media: none status: inactive en3: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=404<VLAN_MTU,CHANNEL_IO> ether f8:e4:3b:ad:67:c5 inet6 fe80::ca4:9a6c:f835:80c9%en8 prefixlen 64 secured scopeid 0x7 inet6 fd84:bb80:dd60:23b3:855:171f:3651:b7de prefixlen 64 autoconf secured inet 192.168.0.35 netmask 0xffffff00 broadcast 192.168.0.255 nd6 options=201<PERFORMNUD,DAD> media: autoselect (1000baseT <full-duplex>) status: active en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 options=460<TSO4,TSO6,CHANNEL_IO> ether 36:e5:80:6e:d1:40 media: autoselect <full-duplex> status: inactive en2: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500 options=460<TSO4,TSO6,CHANNEL_IO> ether 36:e5:80:6e:d1:44 media: autoselect <full-duplex> status: inactive bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=63<RXCSUM,TXCSUM,TSO4,TSO6> ether 36:e5:80:6e:d1:40 Configuration: id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0 maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200 root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0 ipfilter disabled flags 0x0 member: en1 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 11 priority 0 path cost 0 member: en2 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 12 priority 0 path cost 0 member: en3 flags=3<LEARNING,DISCOVER> ifmaxaddr 0 port 13 priority 0 path cost 0 media: <unknown type> status: inactive ap1: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM> ether d6:0f:2c:90:e9:b6 nd6 options=201<PERFORMNUD,DAD> media: autoselect (none) status: inactive en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500 options=6460<TSO4,TSO6,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM> ether c6:2a:06:29:ee:28 nd6 options=201<PERFORMNUD,DAD> media: autoselect status: inactive utun0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500 inet6 fe80::a19f:5de6:a4ca:fd90%utun0 prefixlen 64 scopeid 0x13 nd6 options=201<PERFORMNUD,DAD>
-
Looking at interfaces where the status property is listed as
active, locate the ethernet or wireless interface that connects to your router.Often the prefix of the interface is
en. -
Make a note of the IPv4 address in the inet field.
The address will often start with
192.168.,10.0., or172.16., which are the first digits of the commonly used reserved private IPv4 addresses.In this example, the local IPv4 IP address is
192.168.0.35.You will use this address to access your custom UI app for this tutorial.
Task 1. Running the sample RCS
The sample RCS is a small Node.js application. It parses the consent request JWT, renders the requested authorization_details, and signs the consent response.
-
Clone the SDK sample apps repository:
git clone https://github.com/ForgeRock/sdk-sample-apps -
Change to the sample RCS directory:
cd sdk-sample-apps/rcs/rcs-demo -
Create a locally-trusted certificate for the sample RCS:
mkcert -install mkdir -p .certs mkcert -cert-file .certs/cert.pem -key-file .certs/key.pem localhost 127.0.0.1 <your-local-ip>Replace
<your-local-ip>with the local IP address you noted earlier.The sample RCS serves HTTPS automatically when it finds these certificate files, and the login browser in the sample apps requires HTTPS.
Every address or hostname in the Remote Consent Agent URLs must be covered by the certificate.
A URL whose host is not in the certificate list fails TLS validation in the browser and in the sample app, even though the sample RCS is running.
If your local IP address changes, for example because your network uses DHCP, regenerate the certificate with the new address and update the agent values.
-
Install the dependencies, and start the application:
npm install npm startThe sample RCS listens on port 8081 on all network interfaces over HTTPS.
To output additional messages to the console you can run the sample RCS with
npm run debug.If a RAR flow fails, the debug output shows each request the sample RCS receives, and the consent response it returns.
-
Note the JWK set the sample RCS prints to the console when it starts:
Example console output from starting the sample RCS, showing the JWK set to paste into the Remote Consent Agentnpm notice run rcs-demo@1.0.0 start npm notice run node server.js --- Paste into the RCS agent’s Json Web Key field: --- {"keys":[{"kty":"RSA","n":"...","e":"AQAB","kid":"rcs-demo-signing-key","alg":"RS256","use":"sig"}]} ----------------------------------------------------- RCS demo listening on https://0.0.0.0:8081 Metadata: https://localhost:8081/metadata JWK set: https://localhost:8081/keys Supported types: account_information, payment_initiationYou will paste this value into the Remote Consent Agent configuration when you prepare the authorization server in step 2.
-
Check the sample RCS is serving its metadata over HTTPS by browsing to
https://<your-local-ip>:8081/metadata, replacing<your-local-ip>with the local IP address you noted earlier.Your browser must load the page with no certificate warning, because the certificate covers your local IP address.
The response lists the authorization detail types the sample RCS supports:
Example RCS metadata document listing the supported authorization detail types{ "authorization_details_types_supported": [ "account_information", "payment_initiation" ] }