<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Mark Nienaber on Medium]]></title>
        <description><![CDATA[Stories by Mark Nienaber on Medium]]></description>
        <link>https://medium.com/@marknienaber?source=rss-ee99e09cb4f8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ft40BMQkVGMJM1NbhRqqOw@2x.jpeg</url>
            <title>Stories by Mark Nienaber on Medium</title>
            <link>https://medium.com/@marknienaber?source=rss-ee99e09cb4f8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 03:06:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@marknienaber/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[From Zero to Ping, Automating a Classic Ping Identity Stack]]></title>
            <link>https://marknienaber.medium.com/from-zero-to-ping-automating-a-classic-ping-identity-stack-d5f0d0f708bf?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/d5f0d0f708bf</guid>
            <category><![CDATA[infrastructure-as-code]]></category>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ping-identity]]></category>
            <category><![CDATA[single-sign-on]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 05:53:34 GMT</pubDate>
            <atom:updated>2026-07-31T05:53:34.850Z</atom:updated>
            <content:encoded><![CDATA[<h3>PingDirectory, PingFederate and PingAccess: One Integrated Environment</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xopvJk6iJzRoD9A1DpztQ.png" /><figcaption>From Zero to Ping</figcaption></figure><p>Identity and access management sits at the centre of every serious security programme. Organisations must authenticate users, authorise access, protect APIs and federate with partners, all in a way that is repeatable, reviewable and recoverable. When those tasks become hand-crafted, click-through exercises in an administrative console, the process stops being repeatable and becomes tribal knowledge.</p><p>Ping Identity’s classic suite of PingDirectory, PingFederate and PingAccess provides a proven, widely deployed answer to these requirements. Installing it manually, however, involves a lot of moving parts. You need to populate a directory, configure a federation server with adapters, credential validators, OAuth clients and token policies, and connect an access gateway to the federation server as its token provider. Get the sequence wrong or miss a single service-account ACI, and the integration fails.</p><p>This article introduces an automation project that deploys the complete stack. It installs and integrates PingDirectory, PingFederate and PingAccess on a single Linux server, configures them using realistic deployment patterns and verifies the result through an end-to-end browser single sign-on flow. The project is intended for development and evaluation, with the closing section explaining what must change on the path to production.</p><p>It follows the same philosophy as my earlier article, <a href="https://medium.com/@marknienaber/automating-ping-advanced-identity-software-deployment-5db1748d348b?sharedUserId=marknienaber"><em>Automating Ping Advanced Identity Software Deployment</em></a>: scripted, orchestrated deployment applied to the classic Ping Identity stack.</p><p>The scripts are available on <a href="https://github.com/mark-nienaber/ping_fed_installer">GitHub</a>.</p><h3>The Ping Installer</h3><p>The installer does not just drop three products onto a host and leave them running side by side. It builds the integration, the wiring that turns three servers into one secure identity system.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-9YgMFbqqcVhwFalFWOlAg.png" /><figcaption><em>The topology. Everything sits behind an HAProxy load balancer on port 443. PingAccess and PingFederate are reached by hostname, PingAccess talks to PingFederate through the load balancer, and PingFederate authenticates against PingDirectory. The dashed second node of each tier is what the HA flag adds.</em></figcaption></figure><p>A browser asks PingAccess for a protected application. PingAccess sees no session and redirects the user to PingFederate, its configured OIDC token provider. PingFederate presents a login form, binds to PingDirectory to validate the credentials, issues its tokens, and hands the user back to PingAccess, which lets them through to the application with an identity header injected. Three products, one flow.</p><h3>Core components</h3><p>The stack installs in strict dependency order, because each product depends on the one before it.</p><ul><li><strong>PingDirectory </strong>11.1.0.0 is the LDAPv3 user store, and it also serves as the session and OAuth grant store. Users live under ou=people, and the federation server&#39;s own runtime state lives alongside them.</li><li><strong>PingFederate</strong> 13.1.1 is the federation and token service. It provides OAuth 2.0 and OpenID Connect, an HTML form IdP adapter, credential validation against the directory, and the token policies that PingAccess relies on.</li><li><strong>PingAccess</strong> 9.1.0 is the access gateway and policy enforcement point. It fronts the protected application on a virtual host, delegates authentication to PingFederate, and enforces the result.</li></ul><p>Everything runs on OpenJDK 21 on a single Linux server. The reference host is RHEL or CentOS, every certificate is self signed, and the whole thing is designed to come up cleanly from a cold machine.</p><h3>The externalised session model</h3><p>If there is one design decision that separates a toy deployment from a realistic one, it is where PingFederate keeps its sessions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2qDZ8Y5VRfImQzqrGjMtRQ.png" /><figcaption><em>The installer always persists sessions and grants to the directory. It is the difference between a stack that is suitable only for a demo and one shaped for production.</em></figcaption></figure><p>Out of the box, PingFederate can store SSO sessions and OAuth grants in memory. That is adequate for a five-minute demonstration, but unsuitable for a persistent or scalable environment. Every restart ends all active sessions, and engine nodes cannot share session state, making horizontal scaling impossible.</p><p>The installer stores both sessions and grants in PingDirectory. Sessions reside under ou=AuthenticationSessions, while grants reside under ou=AccessGrant in the same replicated directory as the users. This makes sessions durable across restarts and shareable across a cluster of PingFederate engines, following the pattern commonly used in production. The installer always enables this configuration, so it cannot be accidentally omitted.</p><p>Externalising sessions involves more than changing the storage location. The installer also configures the supporting controls required by a realistic deployment:</p><ul><li><strong>Dedicated service account:</strong> PingFederate binds as cn=pingfederate rather than using the directory root account.</li><li><strong>Least-privilege access:</strong> The service account receives read access to user entries and read-write access only to the session and grant containers.</li><li><strong>Indexed grant storage:</strong> The grant store is indexed so that searches and expiry cleanup remain efficient as the dataset grows.</li><li><strong>Directory-backed administration:</strong> PingFederate administrators authenticate as LDAP users in PingDirectory, allowing the entire stack to be provisioned without an interactive setup wizard.</li></ul><h3>Configuration management</h3><p>There is a single source of truth, a file called pingconfig.env. Hosts, ports, licences, passwords, the HA flag and a couple of feature flags all live in one place. You edit it once, and every script reads from it.</p><p>The configuration itself is applied through each product’s administrative REST API, and every operation is idempotent. Rather than blindly creating objects, each step checks whether something already exists and only creates it if it does not. Run a phase twice and it will notice what is already there and skip it. That property is what makes the whole process safe to repeat, which in turn is what makes it useful for iterating on a deployment instead of rebuilding from scratch every time.</p><h3>Orchestrated deployment flow</h3><p>The installation runs in three phases, tracked in a small state file so that repeated runs skip work that is already done.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ePMM-pKBFYd-C6DLV8UlrA.png" /><figcaption><em>Three phases, driven entirely by the configuration file.</em></figcaption></figure><ol><li><strong>Phase 1: Install.</strong> Unzip each product, apply its licence and start a baseline instance in dependency order: PingDirectory, PingFederate and then PingAccess.</li><li><strong>Phase 2: Configure.</strong> Create the directory content, schema, service account, ACIs and grant indexes. Configure the PingFederate datastore, administrative authentication, IdP adapter, credential validator, OAuth and OIDC clients, and externalised session and grant storage. Then configure the PingAccess token provider, virtual host, site, application and identity mapping.</li><li><strong>Phase 3: Integrate.</strong> Connect PingAccess to PingFederate as its token provider, deploy a small protected sample application and add test users to the directory.</li></ol><h3>Deployment flexibility: one flag for high availability</h3><p>The topology is driven by a single flag in the configuration file, HA. The same scripts build either a single-node deployment or a two-node replicated and clustered deployment, with the load balancer always in front. Set HA in pingconfig.env, and the orchestrator runs or skips replication, clustering and LDAPS failover hardening to match.</p><p>Whichever mode you choose, the overall shape remains the same. An HAProxy load balancer provides the single entry point on port 443. It routes app.example.com to PingAccess and ping.example.com to PingFederate, then re-encrypts traffic to the HTTPS backends. PingAccess also reaches PingFederate through the load balancer, keeping failover and scaling transparent. PingFederate connects directly to PingDirectory over LDAPS.</p><p>With HA=true the installer builds the full high availability topology.</p><ul><li><strong>PingDirectory</strong> becomes a replicated pair. Node 2 installs on its own ports, joins node 1 and initialises from it. Replication then runs in both directions.</li><li><strong>PingFederate</strong> becomes a cluster containing a console and an engine. Node 1 remains the configuration authority, while node 2 is a stateless engine cloned from it. Because sessions and grants reside in the replicated directory, additional engines can be added behind the load balancer.</li><li><strong>Directory connectivity</strong> is hardened. Both the runtime datastore and the administrative LDAP connection use LDAPS, with both directory nodes configured for failover. If node 1 stops during a login, single sign-on continues through node 2.</li></ul><p>This remains a single-host demonstration, with nodes sharing a machine and using offset ports. It exercises the real clustering, replication and failover mechanisms, while a production deployment would place each node on a separate host using identical ports.</p><p>The default single-node configuration is:</p><pre>HA=false</pre><p>In this mode, the orchestrator skips replication, clustering and LDAPS failover hardening. It runs one PingFederate instance and one PingDirectory instance. The load balancer, product integration, externalised session storage and end-to-end single sign-on flow remain the same. PingAccess runs as a single instance in either mode.</p><h3>Benefits in the real world</h3><p>Automating the stack provides three benefits that matter beyond the demonstration:</p><ul><li><strong>Repeatability:</strong> The same configuration produces the same stack every time, preventing drift between the intended and deployed environments.</li><li><strong>Reviewability:</strong> The entire deployment is stored as code in a Git repository, so changes can be compared, reviewed and understood before they are applied.</li><li><strong>Recoverability:</strong> Every step is idempotent and safe to repeat. A single --reinstall command can rebuild a damaged environment from scratch.</li></ul><h3>Getting Started: From Zero to Hero</h3><h3>Prerequisites</h3><p>Prepare a single Linux VM with:</p><ul><li><strong>Operating system:</strong> CentOS Stream 9 or Ubuntu 24.04 LTS</li><li><strong>Memory:</strong> At least 10 GB of RAM</li><li><strong>Storage:</strong> At least 10 GB of free space in the installation location</li><li><strong>Access:</strong> A user account with sudo privileges</li></ul><p>These requirements support both the single-node and HA demonstration modes.</p><p>Before running the installer, prepare the host with:</p><pre>./bin/ping-setup.sh</pre><p>This required setup step:</p><ul><li>Installs OpenJDK 21</li><li>Creates the /ping installation directory</li><li>Adds the required hostnames to /etc/hosts</li><li>Raises the file and process limits required by PingDirectory</li><li>Opens the necessary firewall ports</li></ul><p>If this step is skipped, Phase 1 will fail when it attempts to install the products into a directory that does not exist.</p><p>Place each product archive and its licence file in the corresponding directory:</p><pre>software/pd/    PingDirectory-*.zip    *.lic<br>software/pf/    pingfederate-*.zip     *.lic<br>software/pa/    pingaccess-*.zip        *.lic</pre><h3>Customising for your environment</h3><p>Everything you are likely to change lives in pingconfig.env. The variables worth knowing first:</p><pre>INSTALL_USER=fradmin            # the OS user that installs and runs the stack<br>BASE_INSTALL_DIR=/ping          # where all three products install<br>PING_HOSTNAME=ping.example.com  # host services bind and advertise<br>DEFAULT_PASSWORD=2FederateM0re! # shared admin and service password, change it<br>LDAP_BIND_DN=cn=pingfederate,ou=applications,dc=example,dc=com<br>HA=false    # false = one node of each; true = a replicated, clustered pair</pre><p>The passwords shipped in the file are development defaults. Change them before doing anything you care about.</p><h3>Script structure</h3><p>The repository is organised by product, with shared orchestration and operator tooling layered above the product-specific scripts:</p><ul><li><strong>bin/</strong> contains the phased orchestrator, install_ping.sh, the host-preparation script, ping-setup.sh, and the operator utilities.</li><li><strong>pingdir/</strong>, <strong>pingfed/</strong> and <strong>pingaccess/</strong> contain the installation and configuration scripts for each product, including clustering and load-balancer helpers.</li><li><strong>lib/</strong> contains shared logging functions and the REST helpers used to communicate with each administrative API.</li><li><strong>pingconfig.env</strong> is the single source of truth for the deployment configuration.</li></ul><h3>Deployment instructions</h3><p>The stack installs and runs under one OS user that has sudo. Create that user, log in as it, and run everything from there. On a cold host:</p><pre># 1. As a sudoer, create the install user with passwordless sudo, <br># then log in as it<br>sudo useradd -m -s /bin/bash fradmin<br>sudo usermod -aG wheel fradmin<br>echo &#39;fradmin ALL=(ALL) NOPASSWD: ALL&#39; | sudo tee /etc/sudoers.d/fradmin<br>sudo -iu fradmin<br><br># 2. From the installer directory, set INSTALL_USER, hostnames and passwords<br>vi pingconfig.env<br><br># 3. Prepare the host: OpenJDK 21, directories, hosts file, OS limits, <br># firewall<br>./bin/ping-setup.sh<br><br># 4. Install and configure everything, then confirm it is healthy<br>./bin/install_ping.sh --all<br><br>./bin/ping-validate.sh</pre><p>If an install is ever corrupted, or you switch the HA flag, ./bin/install_ping.sh --reinstall stops the stack, removes the products and state, and rebuilds from scratch in a single command.</p><p>Once it is up, the interesting test is the one that proves the whole chain fired. Browse to the protected application, sign in as a test user, and watch the request travel the full path.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TwMEMH_FS0QAWq22rPYA-w.png" /><figcaption><em>One login, end to end. The SSO session written midway through lands in the directory, and the application returns the injected identity header, which is proof the whole chain worked.</em></figcaption></figure><p>The stack ships with a small toolbox of operator scripts, so it is something you can actually run rather than just install.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e6UpisISYJI2Di_NcVpVXg.png" /><figcaption><em>Each script reads the HA flag, so it manages exactly the components your configuration declares, whether that is one node or a full cluster.</em></figcaption></figure><p>A single ./bin/ping-control.sh start all brings the stack up in dependency order, and ping-validate.sh runs a set of read only health checks that adapt to the mode you are in, 23 of them in clustered mode across every hop.</p><h3>Watching it run: the live dashboard</h3><p>The command-line tools report the state of the stack on demand, while the dashboard displays it continuously. Start the dashboard with:</p><pre>./bin/ping-control.sh start dash</pre><p>This launches a live web interface on port 8600. It uses a small standard-library Python server with no external dependencies and serves the interface over HTTPS using the same self-signed certificate as the rest of the stack. Open it in a browser, and the view refreshes automatically every few seconds.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HGP9byvVcaWrmwXpIU66lg.png" /><figcaption><em>The live dashboard displays component health, traffic flow, replication status and memory usage.</em></figcaption></figure><p>The dashboard presents the same information as the operator scripts in a more immediate form:</p><ul><li><strong>Status tiles</strong> summarise replication backlog, healthy cluster nodes and total memory usage. Each tile changes from green to amber when a threshold is crossed.</li><li><strong>Traffic flow</strong> shows requests moving through the load balancer and into the identity stack.</li><li><strong>Component health</strong> lists every service with its ports and current heartbeat.</li><li><strong>Memory usage</strong> breaks consumption down by JVM process.</li><li><strong>HA monitoring</strong> adds dedicated panels for PingDirectory replication and the PingFederate cluster when HA=true.</li></ul><p>The live dashboard displays component health, traffic flow, replication status and memory usage.</p><h3>Production considerations and best practices</h3><p>This is a development and evaluation build. Before using it for anything resembling production, several areas must change:</p><ul><li><strong>Certificates:</strong> Replace the self-signed certificates with certificates from a trusted certificate authority, issued to the correct service hostnames.</li><li><strong>Secrets:</strong> Replace the shared development password with distinct, rotated credentials for every account. Inject them from a secrets manager and never commit them to the repository.</li><li><strong>Transport security:</strong> The single-node configuration, HA=false, allows PingFederate to reach the directory over plaintext LDAP for developer convenience. Production deployments should use LDAPS throughout, backed by a properly managed trust store. The HA=true configuration already enables this.</li><li><strong>Topology:</strong> The clustered demonstration runs multiple nodes on one host using offset ports. A production deployment should place each node on a separate host, use identical ports and distribute the nodes across separate fault domains.</li><li><strong>Capacity and monitoring:</strong> Size JVM heaps, connection pools and replication settings against actual workloads. Add centralised logging, monitoring and alerting so failures and capacity problems are detected quickly.</li></ul><p>None of these changes is a reason not to start. They mark the difference between the environment you learn and iterate in today and the one you operate tomorrow.</p><h3>Conclusion</h3><p>Building PingDirectory, PingFederate and PingAccess manually is a complex process that is difficult to reproduce, review or recover. A scripted deployment, driven by one configuration file and built around idempotent phases, externalised session storage and an optional clustered, load-balanced and LDAPS-secured topology, turns a day of careful console work into four commands and a health check.</p><p>Clone the repository, add the product archives and update pingconfig.env to create a fully integrated Ping Identity stack that proves single sign-on from end to end. Use it to learn and iterate in development, then carry the same automated approach towards production.</p><h3>References</h3><ul><li><a href="https://medium.com/github.com/mark-nienaber/ping_fed_installer">Project repository</a></li><li><a href="https://docs.pingidentity.com/pingdirectory/">PingDirectory documentation</a></li><li><a href="https://docs.pingidentity.com/pingfederate/">PingFederate documentation</a></li><li><a href="https://docs.pingidentity.com/pingaccess/">PingAccess documentation</a></li><li><a href="https://medium.com/@marknienaber/automating-ping-advanced-identity-software-deployment-5db1748d348b?sharedUserId=marknienaber"><em>Automating Ping Advanced Identity Software Deployment</em></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d5f0d0f708bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Business Rule Attribute Validation in PingOne Advanced Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/business-rule-attribute-validation-in-pingone-advanced-identity-cloud-40e0ab0da7f2?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/40e0ab0da7f2</guid>
            <category><![CDATA[ami]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[ping-identity]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 03:09:12 GMT</pubDate>
            <atom:updated>2026-04-20T03:21:03.984Z</atom:updated>
            <content:encoded><![CDATA[<h4>Custom IDM Policies</h4><h4>A practical guide to writing and deploying custom validation policies in PingOne AIC</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ATIgpbWn63B-0CGoMhwyGw.png" /></figure><h3>Introduction</h3><p>Customers often need to apply their own validation rules to identity data, for example:</p><ul><li>An email address has to belong to a specific domain</li><li>A phone number needs to match the local numbering plan</li><li>A username has to respect a naming convention</li></ul><p>These rules vary by organisation, and they have to be enforced consistently at the identity layer, and known error codes need to be able to be returned to custom UI’s for translation.</p><p>On-prem PingIDM has supported this for years through its policy registry. You define a <a href="https://docs.pingidentity.com/pingidm/8.1/objects-guide/extending-policies.html">custom policy</a>, attach it to a managed object property, and IDM enforces it on every write, regardless of the channel.</p><p>In PingOne Advanced Identity Cloud (AIC) this capability is not obvious and is not an advertised feature.</p><p>This article walks through a practical method for implementing custom validation policies in AIC using the same <em>config/policy</em> registry that PingIDM has always exposed, attaching those policies to managed object attributes, and optionally translating the resulting policy keys into user-friendly messages on the hosted pages.</p><p>The steps below cover:</p><ul><li>Defining and deploying a custom policy in <em>config/policy</em>.</li><li>Attaching the policy to managed attributes on <em>alpha_user</em>.</li><li>Testing the policy through the REST API and through a registration journey, including the raw policy output and the translated hosted-page message.</li></ul><p>Big shout out to Jake Feasel, PingIDM Product Manager and genuine IDM guru, for pointing me at this technique.</p><h3>Define and Deploy the Custom Policy</h3><p>Custom policies live in IDM’s policy registry at <em>config/policy</em>. Each policy is a JavaScript function that returns an array of failed requirements, along with a small registration block that tells IDM the policy id, the function name, and the requirement keys it can produce.</p><h4>The JavaScript policy</h4><p>Here is a readable example that validates that an email address ends with a configured domain. It defaults to <em>@acme.com</em> when no <em>domain</em> parameter is supplied. A full list of example Javascript policies can be found <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/blob/main/samples/sample-policy.js">here</a>.</p><pre>addPolicy({<br>  policyId: &quot;acme-email-domain&quot;,<br>  policyExec: &quot;acmeEmailDomain&quot;,<br>  validateOnlyIfPresent: true,<br>  policyRequirements: [&quot;ACME_EMAIL_DOMAIN&quot;]<br>});<br>function acmeEmailDomain(fullObject, value, params, property) {<br>  if (value === null || typeof value === &quot;undefined&quot; || String(value).length === 0) {<br>    return [];<br>  }<br>  var domain = (params &amp;&amp; params.domain) ? String(params.domain) : &quot;@acme.com&quot;;<br>  if (domain.charAt(0) !== &quot;@&quot;) {<br>    domain = &quot;@&quot; + domain;<br>  }<br>  domain = domain.toLowerCase();<br>  var normalizedValue = String(value).toLowerCase();<br>  if (normalizedValue.length &lt; domain.length || normalizedValue.substring(normalizedValue.length - domain.length) !== domain) {<br>    return [{ policyRequirement: &quot;ACME_EMAIL_DOMAIN&quot; }];<br>  }<br>  return [];<br>}</pre><p>A few things to note about this shape:</p><ul><li><em>policyId</em> is the identifier you will reference when attaching the policy to a managed attribute.</li><li><em>policyExec</em> is the function name that IDM will call to evaluate the value.</li><li><em>policyRequirements</em> is the list of requirement keys that the function is allowed to emit. These keys are what you will later translate into friendly messages.</li><li><em>validateOnlyIfPresent: true</em> means the policy is skipped when the property is absent or empty, so it behaves well for optional fields.</li><li>The function receives the full object, the value being validated, any parameters configured on the attachment, and the property name. It must return an empty array if the value is valid, or an array of <em>{ policyRequirement, params }</em> objects if not.</li></ul><p>The same pattern is used for the other <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/blob/main/samples/sample-policy.js">Acme-themed rules</a> in this example set: <em>acme-min-length</em>, <em>acme-max-length</em>, <em>acme-valid-au-phone</em>, <em>acme-valid-au-state</em>, and <em>acme-valid-au-postcode</em>. Each is a small, self-contained function that returns either an empty array or a single failed requirement.</p><h4>The deployed config/policy object</h4><p>IDM does not accept the readable JavaScript form directly. Each <em>addPolicy(…)</em> call and its matching function definition have to be concatenated into a single string and placed into the <em>globals.additionalPolicies</em> array on the <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/blob/main/samples/config-policy.json"><em>config/policy</em> </a>object.</p><p>The full deployable object, with all multiple policies, looks like this:</p><pre>{<br>  &quot;_id&quot;: &quot;policy&quot;,<br>  &quot;additionalFiles&quot;: [],<br>  &quot;resources&quot;: [],<br>  &quot;globals&quot;: {<br>    &quot;additionalPolicies&quot;: [<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-email-domain\&quot;,\&quot;policyExec\&quot;:\&quot;acmeEmailDomain\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_EMAIL_DOMAIN\&quot;]}); function acmeEmailDomain(fullObject, value, params, property) { var domain; var normalizedValue; if (value === null || typeof value === \&quot;undefined\&quot; || String(value).length === 0) { return []; } domain = (params &amp;&amp; params.domain) ? String(params.domain) : \&quot;@acme.com\&quot;; if (domain.charAt(0) !== \&quot;@\&quot;) { domain = \&quot;@\&quot; + domain; } domain = domain.toLowerCase(); normalizedValue = String(value).toLowerCase(); if (normalizedValue.length &lt; domain.length || normalizedValue.substring(normalizedValue.length - domain.length) !== domain) { return [{\&quot;policyRequirement\&quot;:\&quot;ACME_EMAIL_DOMAIN\&quot;}]; } return []; }&quot;,<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-valid-au-phone\&quot;,\&quot;policyExec\&quot;:\&quot;acmeValidAuPhone\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_VALID_AU_PHONE\&quot;]}); function acmeValidAuPhone(fullObject, value, params, property) { if (value === null || typeof value === \&quot;undefined\&quot; || String(value).length === 0) { return []; } var normalized = String(value).replace(/[\\s()-]/g, \&quot;\&quot;); if (/^\\+61[2-478]\\d{8}$/.test(normalized)) { return []; } if (/^0[2-478]\\d{8}$/.test(normalized)) { return []; } return [{\&quot;policyRequirement\&quot;:\&quot;ACME_VALID_AU_PHONE\&quot;}]; }&quot;,<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-valid-au-state\&quot;,\&quot;policyExec\&quot;:\&quot;acmeValidAuState\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_VALID_AU_STATE\&quot;]}); function acmeValidAuState(fullObject, value, params, property) { if (value === null || typeof value === \&quot;undefined\&quot; || String(value).length === 0) { return []; } var allowed = [\&quot;ACT\&quot;, \&quot;NSW\&quot;, \&quot;NT\&quot;, \&quot;QLD\&quot;, \&quot;SA\&quot;, \&quot;TAS\&quot;, \&quot;VIC\&quot;, \&quot;WA\&quot;]; var normalized = String(value).trim().toUpperCase(); for (var i = 0; i &lt; allowed.length; i++) { if (normalized === allowed[i]) { return []; } } return [{\&quot;policyRequirement\&quot;:\&quot;ACME_VALID_AU_STATE\&quot;}]; }&quot;,<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-valid-au-postcode\&quot;,\&quot;policyExec\&quot;:\&quot;acmeValidAuPostcode\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_VALID_AU_POSTCODE\&quot;]}); function acmeValidAuPostcode(fullObject, value, params, property) { if (value === null || typeof value === \&quot;undefined\&quot; || String(value).length === 0) { return []; } var normalized = String(value).trim(); if (!/^\\d{4}$/.test(normalized)) { return [{\&quot;policyRequirement\&quot;:\&quot;ACME_VALID_AU_POSTCODE\&quot;}]; } return []; }&quot;,<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-min-length\&quot;,\&quot;policyExec\&quot;:\&quot;acmeMinLength\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_MIN_LENGTH\&quot;]}); function acmeMinLength(fullObject, value, params, property) { var min = (params &amp;&amp; typeof params.min === \&quot;number\&quot;) ? params.min : 0; if (value === null || typeof value === \&quot;undefined\&quot;) { return []; } var length; if (typeof value === \&quot;string\&quot;) { length = value.length; } else if (value instanceof Array) { length = value.length; } else { return []; } if (length &lt; min) { return [{\&quot;policyRequirement\&quot;:\&quot;ACME_MIN_LENGTH\&quot;,\&quot;params\&quot;:{\&quot;min\&quot;:min}}]; } return []; }&quot;,<br>      &quot;addPolicy({\&quot;policyId\&quot;:\&quot;acme-max-length\&quot;,\&quot;policyExec\&quot;:\&quot;acmeMaxLength\&quot;,\&quot;validateOnlyIfPresent\&quot;:true,\&quot;policyRequirements\&quot;:[\&quot;ACME_MAX_LENGTH\&quot;]}); function acmeMaxLength(fullObject, value, params, property) { var max = (params &amp;&amp; typeof params.max === \&quot;number\&quot;) ? params.max : 0; if (value === null || typeof value === \&quot;undefined\&quot;) { return []; } var length; if (typeof value === \&quot;string\&quot;) { length = value.length; } else if (value instanceof Array) { length = value.length; } else { return []; } if (length &gt; max) { return [{\&quot;policyRequirement\&quot;:\&quot;ACME_MAX_LENGTH\&quot;,\&quot;params\&quot;:{\&quot;max\&quot;:max}}]; } return []; }&quot;<br>    ]<br>  }<br>}</pre><p>Each entry in <em>additionalPolicies</em> is a single JavaScript string that IDM will evaluate at startup to register the policy in the engine. An example object with all of the policies referenced in this article can be found <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/blob/main/samples/config-policy.json">here</a>.</p><h4>Push it with a REST call</h4><p>AIC exposes the IDM admin endpoints at <em>/openidm/config/policy</em> on the tenant. A <em>PUT</em> with the full object replaces the current registry:</p><pre>curl -X PUT \<br> &quot;https://&lt;your-tenant&gt;.forgeblocks.com/openidm/config/policy&quot; \<br> -H &quot;Authorization: Bearer $ACCESS_TOKEN&quot; \<br> -H &quot;Content-Type: application/json&quot; \<br> --data @config-policy.json</pre><p>Two operational points that matter in real deployments:</p><p>· <em>config/policy</em> is a full replacement resource. It is not a merge. Every <em>PUT</em> must contain the complete desired set of custom policies. If you send only one entry, the others are removed.</p><p>· Because the object is a single JSON document, it can be tracked in a Git repository alongside the rest of your AIC configuration. Treat it like any other config-as-code artifact. Review changes as diffs, promote through environments with the same tooling you use for managed object schemas, journeys, and scripts. An update is a full replacement, so the Git version is always the source of truth for what is deployed.</p><h4>Attach the Policies to Managed Attributes</h4><p>A policy in <em>config/policy</em> does nothing on its own. It only runs when it is attached to a managed object property. In this example, the <em>alpha_user</em> model is configured with the following attachments:</p><ul><li><em>mail</em> uses <em>acme-email-domain</em> with <em>{ “domain”: “@acme.com” }</em></li><li><em>givenName</em> uses <em>acme-min-length</em> with <em>{ “min”: 2 }</em> and <em>acme-max-length</em> with <em>{ “max”: 50 }</em></li><li><em>sn</em> uses the same min and max length rules</li><li><em>telephoneNumber</em> uses <em>acme-valid-au-phone</em></li><li><em>stateProvince</em> uses <em>acme-valid-au-state</em></li><li><em>postalCode</em> uses <em>acme-valid-au-postcode</em></li></ul><p>The attachment is done on the managed object property itself. Here is the <em>mail</em> property configured in the IDM native console with the custom policy attached:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*q0_LkF_KezNG3C6yMWahrw.png" /><figcaption><em>Mail property validation in IDM</em></figcaption></figure><p>The same configuration can be applied to every property in the same way. The relevant JSON fragment, showing the <em>policies</em> array on each property, looks like this:</p><pre>{<br>    &quot;mail&quot;: {<br>        &quot;_id&quot;: &quot;mail&quot;,<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Email Address&quot;,<br>        &quot;userEditable&quot;: true,<br>        &quot;viewable&quot;: true,<br>        &quot;searchable&quot;: true,<br>        &quot;isPersonal&quot;: true,<br>        &quot;policies&quot;: [<br>            {<br>                &quot;policyId&quot;: &quot;acme-email-domain&quot;,<br>                &quot;params&quot;: {<br>                    &quot;domain&quot;: &quot;@acme.com&quot;<br>                }<br>            }<br>        ]<br>    },<br>    &quot;givenName&quot;: {<br>        &quot;_id&quot;: &quot;givenName&quot;,<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;First Name&quot;,<br>        &quot;policies&quot;: [<br>            {<br>                &quot;policyId&quot;: &quot;acme-min-length&quot;,<br>                &quot;params&quot;: {<br>                    &quot;min&quot;: 2<br>                }<br>            },<br>            {<br>                &quot;policyId&quot;: &quot;acme-max-length&quot;,<br>                &quot;params&quot;: {<br>                    &quot;max&quot;: 50<br>                }<br>            }<br>        ]<br>    },<br>    &quot;telephoneNumber&quot;: {<br>        &quot;_id&quot;: &quot;telephoneNumber&quot;,<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Telephone Number&quot;,<br>        &quot;policies&quot;: [<br>            {<br>                &quot;policyId&quot;: &quot;acme-valid-au-phone&quot;<br>            }<br>        ]<br>    },<br>    &quot;stateProvince&quot;: {<br>        &quot;_id&quot;: &quot;stateProvince&quot;,<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;State/Province&quot;,<br>        &quot;policies&quot;: [<br>            {<br>                &quot;policyId&quot;: &quot;acme-valid-au-state&quot;<br>            }<br>        ]<br>    },<br>    &quot;postalCode&quot;: {<br>        &quot;_id&quot;: &quot;postalCode&quot;,<br>        &quot;type&quot;: &quot;string&quot;,<br>        &quot;title&quot;: &quot;Postal Code&quot;,<br>        &quot;policies&quot;: [<br>            {<br>                &quot;policyId&quot;: &quot;acme-valid-au-postcode&quot;<br>            }<br>        ]<br>    }<br>}</pre><p>Once the attachments are in place, IDM will enforce these rules on every create and update of a managed user, regardless of whether the request came from the REST API, a sync, or a hosted journey.</p><h3>Test the Policies</h3><h4>Validation through the REST API</h4><p>With the policies registered and attached, the first sanity check is a direct REST call against <em>managed/alpha_user</em>. This confirms the policies are live at the IDM layer before any UI is involved.</p><p>A <em>POST</em> with deliberately invalid data:</p><pre># Create a user with deliberately invalid data.<br># Expected outcome: policy validation failure, typically HTTP 403.<br>curl -i -X POST \<br>  &quot;https://&lt;your-tenant&gt;.forgeblocks.com/openidm/managed/alpha_user?_action=create&quot; \<br>  -H &quot;Authorization: Bearer $ACCESS_TOKEN&quot; \<br>  -H &quot;Accept-API-Version: resource=1.0&quot; \<br>  -H &quot;Content-Type: application/json&quot; \<br>  --data &#39;{<br>    &quot;userName&quot;: &quot;demopolicy-api-invalid-01&quot;,<br>    &quot;givenName&quot;: &quot;A&quot;,<br>    &quot;sn&quot;: &quot;B&quot;,<br>    &quot;mail&quot;: &quot;user@gmail.com&quot;,<br>    &quot;telephoneNumber&quot;: &quot;123&quot;,<br>    &quot;stateProvince&quot;: &quot;ZZ&quot;,<br>    &quot;postalCode&quot;: &quot;ABC&quot;<br>  }&#39;</pre><p>IDM rejects the request with a standard policy validation failure. The response body lists every property that failed, the specific requirement keys that fired, and the parameters that were in effect at the time:</p><pre>{<br>  &quot;code&quot;: 403,<br>  &quot;reason&quot;: &quot;Forbidden&quot;,<br>  &quot;message&quot;: &quot;Policy validation failed&quot;,<br>  &quot;detail&quot;: {<br>    &quot;result&quot;: false,<br>    &quot;failedPolicyRequirements&quot;: [<br>      {<br>        &quot;policyRequirements&quot;: [<br>          {<br>            &quot;params&quot;: {<br>              &quot;min&quot;: 2<br>            },<br>            &quot;policyRequirement&quot;: &quot;ACME_MIN_LENGTH&quot;<br>          }<br>        ],<br>        &quot;property&quot;: &quot;givenName&quot;<br>      },<br>      {<br>        &quot;policyRequirements&quot;: [<br>          {<br>            &quot;policyRequirement&quot;: &quot;ACME_EMAIL_DOMAIN&quot;<br>          }<br>        ],<br>        &quot;property&quot;: &quot;mail&quot;<br>      },<br>     ...<br>    ]<br>  }<br>}</pre><p>This is the same shape that IDM has always returned for policy failures. Any API client that already handles policy errors will handle these custom ones without changes. The <em>policyRequirement</em> key is the contract that downstream consumers can match on, whether they are a custom admin UI, an integration layer, or a support tool.</p><h4>Test the Policies Through a Journey</h4><p>The second test is to run the same validation through a registration journey. The journey uses <em>Attribute Collector</em> with <em>validateInputs: true</em>, which tells AIC to send the collected attributes into IDM for validation before reaching the <em>Create Object</em> node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QVTQtU7Xrj6X0eGCgJEpVQ.png" /><figcaption>Sample Journey Configuration</figcaption></figure><p>As you can see the journey is not reimplementing any rules. It is asking IDM to validate against the same policies attached to <em>alpha_user</em>. Let’s test this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*adGGLmQNi-5zdHxIaC1Mng.png" /><figcaption>Enter some invalid values</figcaption></figure><p>Out of the box, when a user submits invalid data in the journey, AIC surfaces the raw policy requirement keys on the hosted page:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*2c0NTJj0oiNoGuicgPOpIA.png" /><figcaption><em>Raw validation output</em></figcaption></figure><p>These raw keys are correct and complete. They carry the policy identifier and any parameters, which is exactly what a custom front-end needs to render its own localized messages. If you are building a bespoke UI over the AIC APIs, this is often the preferred form, because the UI does the translation.</p><p>If you are using the hosted pages directly and want users to see a friendly message without writing a custom UI, the next step is to add a translation.</p><h4>Friendly messages via uilocale/en</h4><p>AIC reads localized strings from the <em>uilocale/&lt;lang&gt;</em> config object. The full example object can be found <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/blob/main/samples/uilocale-en.json">here</a>. Policy requirement keys are mapped under <em>login.common.policyValidationMessages</em>. The full English mapping for the Acme policies looks like this:</p><pre>{<br>    &quot;_id&quot;: &quot;uilocale/en&quot;,<br>    &quot;login&quot;: {<br>        &quot;common&quot;: {<br>            &quot;policyValidationMessages&quot;: {<br>                &quot;ACME_EMAIL_DOMAIN&quot;: &quot;Use an Acme email address that ends in {&#39;@&#39;}acme.com.&quot;,<br>                &quot;ACME_MIN_LENGTH&quot;: &quot;Enter at least {min} characters.&quot;,<br>                &quot;ACME_MAX_LENGTH&quot;: &quot;Enter no more than {max} characters.&quot;,<br>                &quot;ACME_VALID_AU_PHONE&quot;: &quot;Enter a valid Australian phone number.&quot;,<br>                &quot;ACME_VALID_AU_STATE&quot;: &quot;Use a valid Australian state or territory abbreviation, for example NSW or VIC.&quot;,<br>                &quot;ACME_VALID_AU_POSTCODE&quot;: &quot;Enter a valid 4 digit Australian postcode.&quot;<br>            }<br>        }<br>    }<br>}</pre><p>Two things to note about the content:</p><p>· <em>{min}</em> and <em>{max}</em> are substituted at render time from the <em>params</em> returned by the policy function. This is why the policy emits <em>params: { min: min }</em> rather than inlining the number into the message.</p><p>· A literal <em>@</em> in a hosted-page localization string must be escaped as <em>{‘@’}</em>. Without that escape, the page can fail to render the message correctly.</p><p>Push it the same way you pushed <em>config/policy</em>:</p><pre>curl -X PUT \<br> &quot;https://&lt;your-tenant&gt;.forgeblocks.com/openidm/config/uilocale/en&quot; \<br> -H &quot;Authorization: Bearer $ACCESS_TOKEN&quot; \<br> -H &quot;Content-Type: application/json&quot; \<br> --data @uilocale-en.json</pre><p>With that in place, the same invalid submission in the same journey now renders with the translated strings:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/786/1*05-b5XBgfEDi-I2p4oBRYQ.png" /><figcaption><em>Localized validation output</em></figcaption></figure><p>Same policy engine. Same managed object. Same journey. The only change is that the raw requirement keys have been mapped to user-facing text.</p><h3>Why This Pattern Works</h3><p>The approach has three qualities that matter for production deployments.</p><h4>It keeps validation in one place.</h4><p>The rules are defined once in <em>config/policy</em> and enforced by IDM on every write. REST clients, journeys, and any other channel that goes through <em>managed/alpha_user</em> see the same behaviour. There is no logic sitting in the UI layer waiting to drift out of sync.</p><h4>It uses standard AIC and IDM behaviour.</h4><p>There is no custom endpoint, no script service wiring, no additional config object. Everything above is a regular part of the platform, wired together in a supported way.</p><h4>It promotes like normal config.</h4><p><em>Config/policy</em>, the managed object schema, and <em>uilocale/en</em> are all plain JSON that can live in Git and flow through your existing promotion pipeline. The full replacement semantics of <em>config/policy</em> mean the repo is always the source of truth for what is registered in each environment.</p><p>For customers who need business-specific validation in AIC, this is the pattern I reach for. It solves a real requirement with minimal custom surface area, and it lines up with how PingIDM has always handled custom policies on-prem.</p><h3>References</h3><ul><li>Custom Policy Examples (GitHub Repository)<br> <a href="https://github.com/mark-nienaber/aic_idm_custom_policies/tree/main">https://github.com/mark-nienaber/aic_idm_custom_policies/tree/main</a></li><li>Extending the Policy Service in PingIDM (On-Prem Approach)<br> <a href="https://docs.pingidentity.com/pingidm/8.1/objects-guide/extending-policies.html">https://docs.pingidentity.com/pingidm/8.1/objects-guide/extending-policies.html</a></li><li>Authenticating to PingOne AIC REST APIs<br> <a href="https://docs.pingidentity.com/pingoneaic/developer-docs/authenticate-to-rest-api-with-access-token.html">https://docs.pingidentity.com/pingoneaic/developer-docs/authenticate-to-rest-api-with-access-token.html</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40e0ab0da7f2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[AIC Sentinel -A Modern Web-Based Log Viewer for PingOne Advanced Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/aic-sentinel-5730de2e9163?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5730de2e9163</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[ping-identity]]></category>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[logging]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Thu, 26 Feb 2026 02:24:37 GMT</pubDate>
            <atom:updated>2026-09-03T23:30:05.513Z</atom:updated>
            <content:encoded><![CDATA[<h4>Real-time log streaming, intelligent filtering, transaction tracing, and historical search for PingOne AIC</h4><p><em>By Mark Nienaber — February 2026</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Iwalq9EuF3aqZMX_dwvRQw.png" /><figcaption>Another happy customer</figcaption></figure><h3>Introduction</h3><p>PingOne Advanced Identity Cloud (AIC) has fantastic logging capabilities through its monitoring API, giving you access to both audit and debug logs across AM and IDM. And there are genuinely excellent tools for working with them. <a href="https://github.com/vscheuber/fidc-debug-tools">fidc-debug-tools</a> by Volker Scheuber has been my go-to for CLI-based log tailing, and <a href="https://github.com/rockcarver/frodo-cli">Frodo CLI</a> provides powerful command-line access to your AIC environments including log management. I’ve relied on both heavily and still do.</p><p>But I kept wanting something more visual. Something where I could see AM and IDM logs together in one stream, toggle noise categories on and off with a click, hover over a transaction ID and instantly trace every related log entry across both systems. That led me to create <a href="https://github.com/mark-nienaber/aic-sentinel">AIC Sentinel</a>, a browser-based log viewer for PingOne Advanced Identity Cloud that brings real-time streaming, intelligent noise filtering, one-click transaction tracing, historical search, and export capabilities right into your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SMw1L9hiXscQmZROWqCjNA.png" /><figcaption>Simple web interface</figcaption></figure><p>It’s built on the same AIC monitoring API that fidc-debug-tools and Frodo use, but wraps it in an interactive UI that makes debugging sessions genuinely enjoyable rather than something you endure.</p><h3>How Logging Works in PingOne AIC</h3><p>Before getting into the tool, let’s cover the official methods for accessing logs in AIC. Understanding these is important because AIC Sentinel builds on top of the same underlying API.</p><p>PingOne AIC retains logs for 30 days and provides three methods to access them:</p><h4>Method 1: REST API (Pull)</h4><p>The primary programmatic method. You authenticate with an API key and secret, then query the /monitoring/logs endpoints directly.</p><p>Setup: Navigate to Tenant Settings &gt; Global Settings &gt; Log API Keys in the admin console, create a new key, and note the api_key_id and api_key_secret.</p><p>Tail logs (most recent entries):</p><p>curl — get \<br> — header ‘x-api-key: &lt;api-key&gt;’ \<br> — header ‘x-api-secret: &lt;api-secret&gt;’ \<br> — data ‘source=am-authentication’ \<br> ‘https://&lt;tenant-fqdn&gt;/monitoring/logs/tail’</p><p>Query logs (with time range and filters):</p><p>curl — get \<br> — header ‘x-api-key: &lt;api-key&gt;’ \<br> — header ‘x-api-secret: &lt;api-secret&gt;’ \<br> — data ‘source=am-authentication’ \<br> — data-urlencode ‘_queryFilter=/payload/principal eq “user@example.com”’ \<br> ‘https://&lt;tenant-fqdn&gt;/monitoring/logs’</p><p>This gives you full access to everything, and tools like fidc-debug-tools and Frodo CLI make working with these endpoints much more convenient from the command line. That said, when you’re tailing am-everything, the sheer volume of data can be overwhelming in a terminal, which is exactly where a visual interface shines.</p><p>For full details, see the official documentation: <a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-pull.html">Retrieve log entries using the API</a>.</p><h4>Method 2: Admin Console Monitoring (Beta)</h4><p>AIC provides a built-in log monitoring interface in the admin console, available only in development and sandbox environments (not production). Navigate to Monitoring to access live tail, search, and filtering capabilities.</p><p>This is great for quick checks in your lower environments and provides a convenient built-in option without any additional tooling.</p><p>For more details: <a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-monitoring.html">Monitor log entries in the admin console</a>.</p><h4>Method 3: Log Streaming to External SIEM (Push)</h4><p>For production monitoring, AIC supports streaming logs to external platforms like Splunk, Grafana Cloud, Datadog, and New Relic via the telemetry API endpoints.</p><p>This is the recommended approach for production monitoring, alerting, and long-term log retention with your existing observability stack.</p><p>For more details: <a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-push-api.html">Manage log streaming using the API</a>.</p><h3>Why a Web-Based Log Viewer?</h3><p>Between the REST API, the admin console, SIEM streaming, fidc-debug-tools, and Frodo CLI, there’s no shortage of ways to access your AIC logs. They’re all great options, and each has real strengths depending on what you’re trying to do.</p><p>But here’s the thing. During those intense debugging sessions where you’re tailing logs, triggering actions, and trying to figure out what on earth just happened, it can be really hard to piece things together when AM and IDM logs are in separate streams, or when the volume of routine log entries buries the signal in noise. I found myself constantly wishing I could just see everything in one place, click to filter, hover to trace.</p><p><a href="https://github.com/mark-nienaber/aic-sentinel">AIC Sentinel</a> was inspired by the excellent work in fidc-debug-tools and adds a visual, interactive layer on top of the same AIC monitoring API. The key difference is the UI. None of the existing tools provide a browser-based interface for log viewing, and that’s the gap this tool fills.</p><h4>Unified AM + IDM View</h4><p>This is probably my favourite feature. Instead of running separate tails for AM and IDM and trying to mentally correlate timestamps, AIC Sentinel streams both into a single, unified view. Entries are colour-coded by source (amber for AM, cyan for IDM) so you can instantly see which system generated each log entry, without losing the chronological interleaving that’s critical for understanding cross-system flows.</p><p>When you’re debugging an authentication journey that involves IDM callbacks, or tracing an OAuth flow that touches both AM and IDM, having everything in one timeline is a game-changer.</p><h4>14 Noise Filter Categories</h4><p>This is where things get really fun. If you’ve ever tailed am-everything, you know that the vast majority of log entries are internal housekeeping. CTS operations, session lookups, health checks, LDAP connection pool management. Important for the system, but noise when you’re trying to debug.</p><p>Rather than writing custom include/exclude filters for every session, AIC Sentinel groups noisy loggers into 14 categories that you can toggle on or off with a single click:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/294/1*x8tTXC5wvS91g1PoCUgL1w.png" /></figure><p>In a typical debugging session, the default settings alone eliminate the vast majority of noise, leaving you with the entries that actually matter. And if you need to see what a specific category is doing, just toggle it back on. It’s one click.</p><p>You can also mute individual loggers on the fly. Just hover over any logger name in the log viewer and click the mute icon. No need to open settings.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/639/1*2qj_TAKzcmY9-GvaJvQr5Q.png" /><figcaption>Mute noisy loggers</figcaption></figure><h4>Transaction Tracing</h4><p>This is honestly one of the most powerful features, and I’m really excited about how it turned out. Every request that flows through AIC gets a transaction ID that links all the related log entries together, across AM, IDM, authentication nodes, OAuth endpoints, everything.</p><p>In AIC Sentinel, when you hover over any transaction ID, it transforms into an orange Trace badge. Click it, and instantly every log in the viewer filters down to just that transaction. The filter input glows orange so you know tracing is active, and there’s a clear x button to get back to the full view.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5xuUajaO3lxlVy2bY1jCwg.png" /><figcaption>Transaction tracing</figcaption></figure><p>This is incredibly useful for: — Authentication debugging — trace a single login attempt from the initial request through every journey node, callback, and session creation — OAuth flows — follow a token exchange from the authorize endpoint through consent, token generation, and introspection — IDM operations — trace a sync event or managed object operation across all the services involved</p><p>It takes what used to be a manual process of copying transaction IDs and crafting query filters, and turns it into a single click.</p><h4>Smart Log Messages</h4><p>AIC log entries contain rich detail in their JSON payloads, but let’s be honest, parsing through nested JSON to find the event name or the principal isn’t exactly fun. AIC Sentinel extracts contextual information and presents it as a readable summary for each entry. You’ll see the event name, principal, journey/tree name, node outcome, HTTP method and path. The stuff you actually care about at a glance.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*3rCzG6aGgugJbHuM9GqbCw.png" /><figcaption>Smart messages</figcaption></figure><p>This means you can scan through hundreds of log entries quickly, spot the one that looks relevant, and only then expand it to see the full JSON payload with syntax highlighting. It’s a huge time saver.</p><h4>Real-Time WebSocket Streaming</h4><p>Instead of polling from the browser (which would eat through your rate limit in no time), the tool uses a Node.js backend that polls the AIC tail endpoint and streams results to your browser over WebSockets. This gives you a smooth, real-time experience with configurable poll frequency (2–30 seconds) and automatic rate limit management.</p><p>The status bar at the bottom shows your connection state, rate limit usage, log count, and whether you’re in live tailing or historical mode. You always know what’s going on.</p><h4>Historical Search with Easy Mode Switching</h4><p>Open the historical search panel to query logs by time range with quick presets (last 15 minutes, 1 hour, 6 hours, 24 hours) or custom start/end times. Filter by Transaction ID to trace a specific request across both AM and IDM. The tool automatically splits longer time ranges into 24-hour chunks to work within API pagination limits.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/385/1*Ns_ccDjL9fQds5u6Au71ug.png" /><figcaption>Historical search</figcaption></figure><p>When you’re viewing historical results, a prominent banner makes it crystal clear that live tailing is paused, and the status bar shows an amber Historical indicator. One click on Resume Live Tailing gets you back to real-time mode. No more confusion about whether you’re looking at live data or search results.</p><h4>Saved Connections &amp; Session Persistence</h4><p>If you work with multiple tenants (and who doesn’t?), you can save and manage multiple connections with masked credentials. Switch between your development, staging, and sandbox environments without re-entering credentials every time.</p><p>Your entire session state, connection details, filters, noise settings, persists across page refreshes via session storage. Accidentally close the tab? Just reopen it and you’re right back where you were.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*_sUShQtQAMhJ6KwknWHymQ.png" /><figcaption>Saved connections</figcaption></figure><h4>Export</h4><p>Export your logs in three formats:</p><ul><li>JSON — Pretty-printed, suitable for further processing</li><li>Text — Human-readable with timestamps, levels, and loggers</li><li>CSV — With columns for timestamp, source, level, logger, transactionId, and message</li></ul><p>Export all logs or just the currently filtered view. GThank you.reat for sharing with colleagues or attaching to support tickets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*SuJVKvHBRNtnmfBHEDxoTw.png" /></figure><h3>Architecture</h3><p>The tool is intentionally lightweight, just three production dependencies:</p><p>├── server.js # Express + WebSocket entry point<br> ├── src/<br> │ ├── api/<br> │ │ ├── logClient.js # HTTP client for AIC tail + query endpoints<br> │ │ └── rateLimiter.js # Rate limit tracking (60 req/min)<br> │ ├── ws/<br> │ │ └── tailManager.js # Per-client WebSocket polling manager<br> │ ├── routes/<br> │ │ ├── connection.js # POST /api/connect<br> │ │ └── logs.js # Search, config, sources endpoints<br> │ └── data/<br> │ ├── categories.json # 14 noise filter category definitions<br> │ └── sources.json # Log source metadata<br> ├── tests/<br> │ └── e2e.test.js # End-to-end test suite (48 tests)<br> └── public/<br> ├── index.html # Single-page application<br> ├── css/app.css # Tailwind CSS<br> └── js/<br> ├── app.js # Alpine.js store + WebSocket client<br> └── utils/ # Formatting and time utilities</p><p>The backend polls the AIC /monitoring/logs/tail endpoint, respects the 60 requests/minute rate limit via X-RateLimit header tracking, and streams results to connected browsers over WebSockets. The frontend is a single-page application built with Alpine.js and Tailwind CSS (loaded via CDN, no build step required).</p><p>The whole thing is deliberately simple. No webpack, no React build pipeline, no complex state management. Just a Node.js server and a well-structured HTML page. It installs in seconds and just works.</p><h3>Getting Started</h3><h4>Prerequisites</h4><p>· Node.js (v18 or later)</p><p>· AIC Log API credentials — Create these under Tenant Settings &gt; Global Settings &gt; Log API Keys in your AIC admin console</p><h4>Installation</h4><p>Lets clone the public repository, then we will move into the directory and install the prerequsites.</p><p>git clone <a href="https://github.com/mark-nienaber/aic-sentinel.git">https://github.com/mark-nienaber/aic-sentinel.git</a><br> cd aic-sentinel<br> npm install</p><h4>Configuration</h4><p>You can either configure via environment variables (Optional) or enter credentials directly in the browser UI, whichever you prefer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*vQajnS36A4EYK7tYyY-OJw.png" /></figure><p>Or to use environment variables, copy the example file and edit:</p><p>cp .env.example .env</p><p>PORT=3000<br> TENANT_URL=https://your-tenant.forgeblocks.com<br> API_KEY_ID=your-api-key-id<br> API_KEY_SECRET=your-api-key-secret<br> POLL_FREQUENCY=10<br> MAX_LOG_BUFFER=5000</p><h4>Run</h4><p>npm start</p><p>Open your browser to <a href="http://localhost:3000.">http://localhost:3000.</a> If you configured the .env file, your credentials will be pre-filled. Otherwise, enter them in the connection panel and click Connect. You can also save the connection for next time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*-t8UB7V3uRYgdsjFp7Hgew.png" /></figure><h3>Typical Debugging Workflow</h3><p>Here’s how I actually use the tool during a debugging session, and it’s become second nature:</p><ol><li><strong>Connect</strong> to the AIC tenant (or pick a saved connection)</li><li>Check the <strong>noise filters</strong>. The defaults are usually perfect, but if I’m debugging something specific like you can chose appropriately</li><li><strong>Trigger the action</strong> in the AIC tenant (attempt a login, run a sync, trigger an OAuth flow, etc.)</li><li><strong>Scan the smart messages</strong>. The contextual summaries make it easy to spot the entries that matter</li><li><strong>Trace a transaction</strong>. Hover over a transaction ID and click the trace badge to follow a single request across AM and IDM</li><li>Click to <strong>expand</strong> any entry to see the full JSON payload with syntax highlighting</li><li><strong>Mute</strong> a noisy logger. If one particular logger is cluttering things up, just hover and click mute</li><li><strong>Search history</strong> if I need to look back at earlier events</li><li><strong>Export</strong> the filtered logs to share with a colleague or attach to a support ticket</li></ol><p>Now, Fix your problems and try again :)</p><h3>Complementing Existing Tools</h3><p>AIC Sentinel isn’t trying to replace the existing tools. It complements them. Here’s how I think about the options:</p><p><a href="https://github.com/rockcarver/frodo-cli"><strong>Frodo CLI</strong></a> — A powerhouse CLI for managing AIC environments, including log access. If you’re already using Frodo for environment management, its log capabilities are right there.</p><p><strong>AIC Admin Console Monitoring</strong> — Built-in, no setup required, ideal for quick checks in development and sandbox environments.</p><p><a href="https://github.com/vscheuber/fidc-debug-tools"><strong>fidc-debug-tools</strong></a> — Still available for quick CLI-based log tailing. This project was the original inspiration for AIC Sentinel, and I’m grateful for Volker’s excellent work.</p><p><a href="https://github.com/mark-nienaber/aic-sentinel"><strong>AIC Sentinel</strong></a><strong> </strong>— Adds the visual, browser-based layer with unified AM/IDM views, one-click noise filtering, transaction tracing, and interactive historical search.</p><p>All of these tools use the same underlying AIC monitoring API. It’s a matter of choosing the right interface for your workflow. And honestly, I find myself switching between them depending on what I’m doing.</p><h3>Security Considerations</h3><p>A few things to keep in mind:</p><ul><li>This tool is designed for development and debugging use. For production log monitoring, use AIC’s log streaming to an external SIEM.</li><li>Credentials are stored in your browser’s local storage when using saved connections, with API secrets masked in the UI. This is convenient for development but keep it in mind for shared machines.</li><li>The tool runs locally. Your API credentials are sent from the Node.js backend directly to your AIC tenant. They are not transmitted to any third party.</li><li>Rotate your Log API keys periodically, as you would with any credential.</li></ul><h3>Conclusion</h3><p>PingOne Advanced Identity Cloud has excellent logging capabilities, and the ecosystem of tools for working with them keeps getting better. <a href="https://github.com/mark-nienaber/aic-sentinel">AIC Sentinel</a> adds something that was missing from the mix, a browser-based, visual interface inspired by the excellent <a href="https://github.com/vscheuber/fidc-debug-tools">fidc-debug-tools</a> and complementing tools like <a href="https://github.com/rockcarver/frodo-cli">Frodo CLI</a>.</p><p>Whether you’re tracing an authentication journey through every node, following an OAuth token exchange across AM and IDM, debugging a custom script, or just trying to figure out why that one sync job keeps failing at 3am, having a visual interface with unified views, intelligent noise filtering, and one-click transaction tracing makes the whole experience so much better.</p><p>I’ve been using it daily and it’s genuinely transformed how I debug AIC environments. Give it a try and let me know what you think.</p><h3>Disclaimer</h3><p><em>This tool is provided “as is”, without warranty of any kind. Review your organisation’s security policies before using any third-party tool with production credentials. AIC Sentinel is licensed under </em><a href="https://polyformproject.org/licenses/noncommercial/1.0.0/"><em>PolyForm Noncommercial 1.0.0</em></a><em> — free for personal, educational, and non-commercial use. For commercial licensing, contact the author.</em></p><h3>Resources</h3><ul><li><a href="https://github.com/mark-nienaber/aic-sentinel">AIC Sentinel on GitHub</a></li><li><a href="https://github.com/vscheuber/fidc-debug-tools">fidc-debug-tools on GitHub</a></li><li><a href="https://github.com/rockcarver/frodo-cli">Frodo CLI on GitHub</a></li><li><a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs.html">PingOne AIC — Get audit and debug logs</a></li><li><a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-pull.html">PingOne AIC — Retrieve log entries using the API</a></li><li><a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-monitoring.html">PingOne AIC — Monitor log entries in the admin console</a></li><li><a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-log-sources.html">PingOne AIC — Log sources reference</a></li><li><a href="https://docs.pingidentity.com/pingoneaic/latest/tenants/audit-debug-logs-push-api.html">PingOne AIC — Manage log streaming using the API</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5730de2e9163" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cross-Tenant Identity Migration in PingOne Advanced Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/cross-tenant-identity-migration-in-pingone-advanced-identity-cloud-53314a128818?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/53314a128818</guid>
            <category><![CDATA[ping-identity]]></category>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[migration]]></category>
            <category><![CDATA[cloud-migration]]></category>
            <category><![CDATA[pingone]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Mon, 08 Dec 2025 04:53:49 GMT</pubDate>
            <atom:updated>2025-12-09T01:47:22.795Z</atom:updated>
            <content:encoded><![CDATA[<h4>Automating data migration between IDM instances using the IDM External Proxy</h4><p><em>By Mark Nienaber — December 2025</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8lPFosbr08MeSa6VsLVtAA.png" /><figcaption>Cross-Tenant Identity Migration</figcaption></figure><h3>Introduction</h3><p>Migrating identity data into PingOne Advanced Identity Cloud (AIC) is a common requirement. Maybe you’re promoting configurations from a sandbox to production, consolidating multiple tenants after an acquisition, setting up geographic distribution for compliance or latency reasons, or moving from an on-premises deployment to the cloud. While there are several approaches to tackle this, one of the most powerful options is the <strong>IDM External Proxy</strong>.</p><p>This feature allows an IDM instance to connect to and push data to another IDM instance, whether that’s between AIC tenants or from a self-managed on-premises PingIDM deployment to the cloud. It makes migration clean, API-native, and actually quite elegant. Once you’ve used it, you’ll wonder how you managed without it.</p><p>In this article, I’ll walk you through setting up data migration using the IDM External Proxy. I’ve also built an <a href="https://github.com/mark-nienaber/idm_external_proxy_helper">automation script</a> to streamline the setup, because while the configuration is straightforward, automating repetitive tasks is always a good idea.</p><h3>What is the IDM External Proxy?</h3><p>The IDM External Proxy is essentially a bridge that allows one IDM instance to access and push data to another. Once configured, your source system can interact with managed objects on the target AIC tenant, using a path like:</p><p>/openidm/external/idm/{config-name}/managed/{realm}_user</p><p>This opens up some powerful possibilities:</p><p>• <strong>Cross-tenant data migration</strong> — Move users, roles, and other objects between AIC instances</p><p>• <strong>On-premises to cloud migration</strong> — Push identity data from self-managed PingIDM into AIC</p><p>• <strong>Querying across environments</strong> — Read data from one instance while managing it in another</p><p>• <strong>Synchronisation mappings</strong> — Set up reconciliation between separate IDM environments</p><p>• <strong>Testing integration scenarios</strong> — Validate data flows before committing to production</p><p>For more details, check out the official documentation: <a href="https://docs.pingidentity.com/pingoneaic/latest/idm-objects/data-rest-proxy.html">IDM External Proxy — Ping Identity Documentation</a></p><h3>Architecture Overview</h3><p>Before diving into the configuration, let’s understand how the pieces fit together. The setup involves two systems:</p><p><strong>Source (AIC Tenant or On-Prem IDM)</strong> — Where the data currently lives and where the External Proxy config is created. This system initiates the connection and pushes data to the target.</p><p><strong>Target (AIC Tenant)</strong> — The destination for your migration. This is always an AIC tenant that receives the data being pushed from the source.</p><p>The flow works like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*e7n7wHlXkFiPtofJcBTehQ.png" /><figcaption>Runtime Data Flow</figcaption></figure><p>The source system (where the External Proxy is configured) reaches out to the target AIC tenant to push data. The proxy configuration on the source contains the credentials needed to authenticate against the target.</p><h3>Authentication Methods</h3><p>The IDM External Proxy supports two authentication methods, and the one you choose depends on what the target AIC tenant expects:</p><h3>Bearer Authentication (OAuth 2.0)</h3><p>This is the standard approach for connecting to an <strong>AIC tenant as the target</strong>. The source authenticates using OAuth client credentials.</p><pre>{<br>&quot;authType&quot;: &quot;bearer&quot;,<br>&quot;clientId&quot;: &quot;idmprovisioning&quot;,<br>&quot;clientSecret&quot;: &quot;your-secret&quot;,<br>&quot;tokenEndpoint&quot;: &quot;https://target.forgeblocks.com/am/oauth2/realms/alpha/access_token&quot;,<br>&quot;scope&quot;: [&quot;fr:idm:*&quot;]<br>}</pre><h3>Basic Authentication</h3><p>Use this when connecting to a <strong>self-managed (on-premises) PingIDM as the target</strong>, or in simpler configurations. This works well when the target doesn’t have OAuth configured.</p><pre>{<br>&quot;authType&quot;: &quot;basic&quot;,<br>&quot;userName&quot;: &quot;openidm-admin&quot;,<br>&quot;password&quot;: &quot;your-admin-password&quot;<br>}</pre><p>For on-prem to cloud migration, you configure the External Proxy on your on-premises IDM instance (the source) pointing to your AIC tenant (the target). The source pushes data to the target AIC tenant using Bearer authentication.</p><h3>Prerequisites</h3><p>Before you start, you’ll need:</p><p>1. <strong>Two IDM instances</strong> — A source (where data lives and proxy config is created, can be AIC or on-prem) and a target AIC tenant (where data will be migrated TO)</p><p>2. <strong>Authentication credentials</strong> — OAuth client credentials for the target AIC tenant. For on-prem sources: admin access to configure the proxy.</p><p>3. <strong>Administrative access</strong> — Ability to create OAuth clients and modify authentication configuration on the target AIC tenant</p><p>4. <strong>Network connectivity</strong> — The source system must be able to reach the target AIC tenant over HTTPS</p><p>5. <strong>CLI tools</strong> — jq, jose, and openssl installed if you’re using the automation script</p><h3>The Manual Way (Understanding the Pieces)</h3><p>Before introducing the automation, let’s understand what needs to be configured for AIC-to-AIC migration. This will help you troubleshoot issues and customise the setup for your specific requirements.</p><h3>Phase 1: Configure the Target (AIC Destination)</h3><p>The target AIC tenant needs two things: an OAuth client that the source can authenticate with, and a static user mapping that grants the OAuth client appropriate permissions.</p><h3>Step 1: Create the OAuth Client on the Target</h3><p>Navigate to Applications → OAuth 2.0 → Clients in your <strong>target</strong> AIC tenant and create a new client with these settings:</p><p>1. <strong>Client ID:</strong> idmprovisioning (or your preferred name)</p><p>2. <strong>Grant Type:</strong> client_credentials</p><p>3. <strong>Scope:</strong> fr:idm:*</p><p>4. <strong>Token Endpoint Auth Method:</strong> client_secret_post</p><p><strong>Important:</strong> The client_secret_post authentication method is crucial. This means credentials are sent in the POST body rather than as a Basic auth header. Mismatching this is a common source of 401 errors.</p><h3>Step 2: Configure Static User Mapping on the Target</h3><p>The OAuth client needs to be mapped to an IDM admin user. This needs to be done through the openidm/connfig/authentication API (see docs or run the tool to provide the curl command)</p><p>Add a mapping with:</p><p>• <strong>Subject:</strong> idmprovisioning (must match the OAuth client ID)</p><p>• <strong>Local User:</strong> internal/user/openidm-admin</p><p>• <strong>Roles:</strong> openidm-admin, openidm-authorized</p><p>This mapping tells IDM: “When a request comes in authenticated as the idmprovisioning OAuth client, treat it as if it came from the openidm-admin user with full admin permissions.”</p><h3>Phase 2: Configure the Source (Where Data Lives)</h3><p>Now we create the external proxy configuration on your source system — this is where the data currently lives and from where it will be pushed.</p><h3>Step 3: Create the External IDM Proxy Config on the Source</h3><p>Create a configuration object via the IDM REST API on your <strong>source</strong> system:</p><pre>PUT /openidm/config/external.idm-targetaic<br>{<br>&quot;enabled&quot;: true,<br>&quot;authType&quot;: &quot;bearer&quot;,<br>&quot;instanceUrl&quot;: &quot;https://target.forgeblocks.com/openidm/&quot;,<br>&quot;clientId&quot;: &quot;idmprovisioning&quot;,<br>&quot;clientSecret&quot;: &quot;your-client-secret&quot;,<br>&quot;scope&quot;: [&quot;fr:idm:*&quot;],<br>&quot;tokenEndpoint&quot;: &quot;https://target.forgeblocks.com/am/oauth2/realms/alpha/access_token&quot;,<br>&quot;tokenEndpointAuthMethod&quot;: &quot;client_secret_post&quot;,<br>&quot;scopeDelimiter&quot;: &quot; &quot;<br>}</pre><p><strong>Note the naming convention:</strong> The configuration is stored at external.idm-targetaic (with a hyphen), but accessed at runtime via /openidm/external/idm/targetaic/… (with slashes). This trips up a lot of people.</p><h3>Step 4: Test the Configuration</h3><p>Once configured, test by querying through the proxy on your <strong>source</strong> system:</p><pre>GET /openidm/external/idm/targetaic/managed/alpha_user?_queryFilter=true&amp;_pageSize=1</pre><p>If successful, you’ll see user data from your target AIC tenant, confirming the connection works. You can then set up sync mappings to push data from source to target.</p><h3>The Automated Way</h3><p>Manual configuration is great for understanding, but automating repetitive tasks makes sense for efficiency. That’s why I created the <strong>IDM External Proxy Manager</strong> script.</p><p>You can find the complete project on GitHub: <a href="https://github.com/mark-nienaber/idm_external_proxy_helper">github.com/mark-nienaber/idm_external_proxy_helper</a></p><h3>What the Script Does</h3><p>The script provides an interactive menu that handles:</p><p>• OAuth client creation on the target AIC tenant</p><p>• Static user mapping configuration on the target</p><p>• External IDM proxy creation on the source</p><p>• Proxy verification and testing</p><p>• Sync mapping creation for reconciliation</p><p>• Cleanup and deletion of configurations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/388/1*GU74bcSqf-20YpFRehhz8Q.png" /><figcaption>IDM External Proxy Manager</figcaption></figure><p>It also has two execution modes: <em>Show Commands</em> (displays the curl commands without executing) and <em>Run Commands</em> (actually executes them). I’d recommend starting with Show Commands to review what’s happening before making changes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/699/1*6H_U3UioCnA0-cNw4epejw.png" /><figcaption>Execution Modes</figcaption></figure><h3>Quick Start</h3><p>1. <strong>Clone the repository:</strong></p><pre>git clone https://github.com/mark-nienaber/idm_external_proxy_helper<br>cd idm_external_proxy_helper<br>chmod +x idm_external_proxy_manager.sh</pre><p>2. <strong>Set up your service account keys:</strong></p><pre>mkdir -p keys</pre><p>Place your service account JWK files in the keys/ directory.</p><p>3. <strong>Configure your environment:</strong></p><pre>cp .env.template .env</pre><p>Edit .env with your tenant details, service account IDs, and OAuth client credentials.</p><p>4. <strong>Run the script:</strong></p><pre>./idm_external_proxy_manager.sh</pre><p>Recommended Workflow</p><p>For a complete AIC-to-AIC setup, follow this order:</p><p>1. <strong>Option 1: Configure Target Tenant</strong> — Creates the OAuth client and static user mapping on the target (AIC destination)</p><p>2. <strong>Option 2: Configure Source Tenant</strong> — Creates the external IDM proxy configuration on the source (where data lives)</p><p>3. <strong>Option 3: Verify Configuration</strong> — Tests the proxy by querying data through it</p><p>4. (optional) <strong>Option 4: Create Sync Mapping</strong> — Sets up reconciliation to push data from source to target</p><h3>Real-World Use Cases</h3><h3>Sandbox to Production Migration</h3><p>The most common use case. You’ve been testing in a sandbox tenant, everything’s working, and now you need to move your identity data to production. Set up the external proxy on your sandbox (source) pointing to production (target), create your sync mappings, run a reconciliation, and push your data across.</p><h3>Geographic Distribution</h3><p>Need to replicate identity data across regions for latency or compliance reasons? You can set up bidirectional sync between tenants using external proxies on both sides. Each tenant can act as both source and target depending on the direction of data flow.</p><h3>Tenant Consolidation</h3><p>Acquired another company with their own AIC tenant? Configure the external proxy on the acquired tenant (source) pointing to your primary tenant (target), push their identity data across, merge and deduplicate as needed, and maintain a single source of truth.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WHhIDwX5R8VwV26Vc8HyPA.png" /><figcaption>Use Cases Overview</figcaption></figure><h3>On-Premises to Cloud Migration</h3><p>Moving from a self-managed PingIDM deployment to AIC? The External Proxy makes this transition straightforward. Configure the proxy on your on-prem instance (source) pointing to your AIC tenant (target) using Bearer authentication, set up your sync mappings, and migrate users in controlled batches. This approach lets you run both systems in parallel during the transition period, validating data integrity before cutting over.</p><p>A few considerations for on-prem to cloud scenarios:</p><p>• <strong>Network connectivity</strong> — Your on-prem IDM (the source) needs to be able to reach the AIC tenant (target) over HTTPS.</p><p>• <strong>Authentication</strong> — Bearer auth is used to authenticate against the target AIC tenant’s OAuth client.</p><p>• <strong>Incremental migration</strong> — Use query filters in your sync mappings to migrate users in phases rather than all at once.</p><h3>Troubleshooting</h3><p>Here are the common issues and how to resolve them.</p><h3>401 Unauthorised</h3><p>This usually means authentication to the target AIC tenant failed. Check:</p><p>• Client ID and secret are correct in the external proxy config on the source</p><p>• Token endpoint auth method is set to client_secret_post on both the OAuth client (target) and the proxy config (source)</p><p>• The OAuth client exists in the correct realm on the target (alpha/bravo)</p><h3>403 Forbidden</h3><p>Authentication succeeded, but authorisation failed. Check:</p><p>• Static user mapping exists on the target with subject matching the OAuth client ID exactly</p><p>• The mapped local user has the required roles (openidm-admin, openidm-authorized)</p><p>• The OAuth client has the fr:idm:* scope</p><h3>404 Not Found</h3><p>The proxy config or endpoint wasn’t found. Remember:</p><p>• Config path uses hyphens: /openidm/config/external.idm-targetaic</p><p>• Runtime path uses slashes: /openidm/external/idm/targetaic/…</p><p>• Realm name must match what exists on the target (alpha_user vs bravo_user)</p><h3>Security Considerations</h3><p>A few things to keep in mind for production deployments:</p><p>• <strong>Use dedicated service accounts</strong> — Don’t reuse credentials across different integrations</p><p>• <strong>Rotate credentials regularly</strong> — OAuth client secrets should be rotated periodically</p><p>• <strong>Minimum necessary permissions</strong> — While I’ve used openidm-admin for simplicity, consider using more restrictive roles in production</p><p>• <strong>Enable audit logging</strong> — Ensure you can track who’s accessing what data</p><p>• <strong>Never commit secrets to version control</strong> — Keep your .env and JWK files out of Git</p><h3>Conclusion</h3><p>The IDM External Proxy is a versatile feature that addresses a range of identity migration scenarios. Whether you’re migrating from sandbox to production, consolidating tenants, setting up geographic distribution, or moving from on-premises to the cloud, this approach gives you a clean, API-native way to push identity data into your AIC tenant.</p><p>The automation script takes the repetitive work out of the AIC-to-AIC setup, but understanding the underlying components — OAuth clients, static user mappings, and external proxy configs — will help you adapt the solution to your specific needs, including on-prem scenarios.</p><p>Give it a try in your development environment, validate the data flows, and then move to production with confidence.</p><h3>Disclaimer</h3><p><em>This script and documentation are provided FOR TESTING AND INFORMATIONAL USE ONLY.</em> This software is provided “AS IS”, without warranty of any kind. Always test in a non-production environment first, and use at your own risk.</p><h3>Resources</h3><p>• <a href="https://github.com/mark-nienaber/idm_external_proxy_helper">IDM External Proxy Manager on GitHub</a></p><p>• <a href="https://docs.pingidentity.com/pingoneaic/latest/idm-objects/data-rest-proxy.html">Official Ping Identity Documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=53314a128818" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Ping Advanced Identity Software Deployment]]></title>
            <link>https://marknienaber.medium.com/automating-ping-advanced-identity-software-deployment-5db1748d348b?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/5db1748d348b</guid>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[scripting]]></category>
            <category><![CDATA[ping]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Tue, 02 Sep 2025 23:42:47 GMT</pubDate>
            <atom:updated>2025-09-11T05:52:11.550Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Building a simple identity infrastructure with automated deployment scripts and shared repository architecture</em></p><h4>Introduction</h4><p>In today’s enterprise landscape, identity and access management (IAM) is the cornerstone of digital security. Organisations need robust, scalable solutions to handle authentication, authorisation, user provisioning, and API protection while adapting to evolving business requirements.</p><p><a href="https://www.pingidentity.com/en/resources/blog/post/iam-private-cloud-fabric.html">Ping Advanced Identity Software</a> offers a comprehensive, unified platform that integrates access management, identity management, directory services, and gateway capabilities into a single, cohesive solution, all fronted by the Platform UI’s to access the functionality.</p><p>This <a href="https://github.com/mark-nienaber/Platform8Install">Platform 8 Installation Suite</a> provides a set of scripts to install the platform as described in Ping Identity’s Documentation site <a href="https://docs.pingidentity.com/platform/8/platform-guide/about.html">here</a>. This suite</p><p>This is a <strong>sample deployment</strong> of all components on a <strong>single Linux server</strong>. It’s designed for <strong>development and evaluation purposes only</strong> and should not be used in production. While the scripts can be adapted for a <strong>multi-server or distributed architecture</strong>, the example here is simplified to serve as a <strong>reference development instance</strong>.</p><h3>The Ping Identity Platform 8 Installation Suite</h3><p>The <a href="https://github.com/mark-nienaber/Platform8Install">Platform 8 Installation Suite</a> is a purpose-built automation framework that slashes deployment complexity and accelerates time-to-value. It turns a once-lengthy manual process into a streamlined workflow, enabling a complete identity environment deployment in hours.</p><h4>Unified Platform Architecture</h4><p>The suite’s strength is in integrating every major platform component into a coherent deployment:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*Gr9LjxBjdXQ8Vdo5hZe0Eg.png" /><figcaption>Shared Repository Platform</figcaption></figure><h4>Core Components</h4><p><strong>PingAM (Access Management)</strong></p><p>Handles authentication, authorisation, and federation with support for OAuth2, OIDC, SAML, adaptive authentication, and risk-based policies.</p><p><strong>PingIDM (Identity Management)</strong></p><p>Manages the full identity lifecycle, including workflow-driven provisioning and synchronisation across diverse data sources.</p><p><strong>PingDS (Directory Services)</strong></p><p>A high-performance LDAP store optimised for identity workloads, featuring native replication and high-availability.</p><p><strong>PingGateway</strong></p><p>An intelligent reverse proxy and API gateway that protects legacy and modern applications with flexible request/response transformations. In this case PingGateway protects AM and IDM and the Platform UI’s.</p><p><strong>Platform UI’s</strong></p><p>Modern, responsive interfaces for admins and end-users, with branding and mobile-first design support.</p><h4>The Shared Repository Model</h4><p>A standout innovation is the <strong>shared repository approach</strong>, in which PingAM and PingIDM store their identities in the same repository rather than using an additional process to keep identities synchronised.</p><h4>Configuration Management</h4><ul><li>All environment variables centralised in platformconfig.env.</li><li>Component configurations templated and dynamically customised.</li><li>Authentication trees and policies version-controlled for CI/CD integration.</li><li>Secure handling of secrets and certificates through automated processes.</li></ul><h4>Orchestrated Deployment Flow</h4><ol><li>Setup OS with all Prerequisites</li><li>Deploy PingDS (multiple, role-specific instances).</li><li>Install and configure PingAM (FBC or DS mode).</li><li>Integrate PingIDM.</li><li>Deploy PingGateway with routes to protect AM, IDM and UI’s.</li><li>Apply REST-based configuration of PingAM.</li><li>Install Platform UI’s.</li></ol><h4>Deployment Flexibility: FBC vs. DS</h4><p>PingAM can store it’s configuration in Files (FBC) or PingDS, you have the option to use one or the other. For more details see <a href="https://docs.pingidentity.com/pingam/8/install-guide/prepare-ext-stores.html">here</a>.</p><ul><li><strong>File-Based Configuration (FBC)</strong>: Perfect for DevOps pipelines and containerised environments — version control-friendly and configuration-as-code ready. While this deployment does not use containers, this install mode will allow you to work with and understand this deployment option.</li><li><strong>DS-Based Configuration</strong>: Ideal for dynamic updates, with configuration persistence in DS.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yB5HxUckl9e6liolfnj8ZA.png" /><figcaption>PingAM Configuration Options</figcaption></figure><h4>Real-World Benefits</h4><ul><li><strong>Accelerated Development &amp; Testing</strong>: Consistent deployments reduce setup times from days to hours, boosting productivity across dev/test/prod.</li><li><strong>Operational Reliability</strong>: Prevents configuration drift, validates setups pre-production, and offers auditable logs with rollback options.</li></ul><h3>Getting Started: From Zero to Hero</h3><p>This suite simplifies standing up a <strong>sample deployment</strong> on a <strong>single Linux server</strong> — ideal for <strong>development and evaluation only</strong>, not production.</p><h4>Prerequisites</h4><ul><li>Linux.</li><li>OpenJDK 21+.</li><li>Apache Tomcat 10.x.</li><li>Minimum 8GB+ RAM.</li><li>20GB+ free storage.</li></ul><h4>Environment-Specific Customisation</h4><p>The platformconfig.env file offers extensive flexibility. The values can be changed to suite your environment, however, ensure that any values you change match of the pre-configured files.</p><pre># ----------------------------------------------------------<br># Software Versions<br># ----------------------------------------------------------<br>DS_VERSION=&quot;8.0.0&quot;<br>AM_VERSION=&quot;8.0.1&quot;<br>AMSTER_VERSION=&quot;8.0.1&quot;<br>IDM_VERSION=&quot;8.0.0&quot;<br>IG_VERSION=&quot;2025.3.0&quot;<br>UI_VERSION=&quot;8.0.1.0523&quot;<br># ----------------------------------------------------------<br># Hostnames Configuration<br># ----------------------------------------------------------<br>AM_HOSTNAME=&quot;am.example.com&quot;<br>IDM_HOSTNAME=&quot;openidm.example.com&quot;<br>IG_HOSTNAME=&quot;platform.example.com&quot;<br># ----------------------------------------------------------<br># Security and Credential Settings<br># ----------------------------------------------------------<br>DEFAULT_PASSWORD=&quot;password&quot;<br>DS_ADMIN_PASSWORD=&quot;${DEFAULT_PASSWORD}&quot;<br>LDAP_BIND_PASSWORD=&quot;${DS_ADMIN_PASSWORD}&quot;<br># ----------------------------------------------------------<br># Directory Services (DS) Specific Configuration<br># ----------------------------------------------------------<br>DS_IDREPO=&quot;${DS_DIR}/idrepo&quot;<br>DS_CONFIG=&quot;${DS_DIR}/config&quot;<br>DS_CTS=&quot;${DS_DIR}/cts&quot;<br>DS_IDREPO_SERVER=&quot;${AMIDMREPO_HOSTNAME}&quot;<br>DS_IDREPO_SERVER_LDAP_PORT=2389<br>DS_IDREPO_SERVER_LDAPS_PORT=2636<br>DS_IDREPO_SERVER_HTTP_PORT=28081<br>DS_IDREPO_SERVER_HTTPS_PORT=28443</pre><h4>Script Structure:</h4><p>Each product is installed with it’s own script and orchestrated with the install_platform8.sh script in the root directory. To run any script separately run them from the root directory as follows:</p><pre>./misc/platform8-setup.sh # Configure prerequisites<br><br>./misc/platform8.control.sh # Start/Stop/Status of platform<br><br>./install_platform8.sh   # Main Deplyment script<br><br>./ds/ds8.sh              # Deploy DS instances<br>./am/am8.sh              # Deploy AM (DS mode)<br>./am/am8fbc.sh           # Deploy AM (FBC mode)<br>./idm/idm8.sh            # Deploy IDM<br>./ig/ig8.sh              # Deploy IG with routes</pre><h4>Deployment Instructions</h4><p>Do the following to get your environment up and running fast!</p><p><strong>Create your linux administrative user</strong></p><p>This must be done ahead of time, by default the script uses a user named fradmin, this will need to match the user in platformconfig.env file. This is also the <em>ONLY MANDATORY MANUAL STEP</em>, everything else can be run by default values.</p><p>Once you’ve created that user change to the user and do all other opperations as that user.</p><pre># ==========================================================<br># Platform 8 Installation - Environment Configuration<br># ==========================================================<br><br># ----------------------------------------------------------<br># General Script Settings<br># ----------------------------------------------------------<br>INSTALL_USER=&quot;fruser&quot;</pre><p><strong>Clone the repository</strong></p><pre># clone the repository<br>git clone https://github.com/mark-nienaber/Platform8Install<br><br># change to the directory<br>cd Platform8Install</pre><p><strong>Place software binaries</strong></p><pre># Add platform binaries to software/ directories<br>├── software<br>│   ├── am<br>│   │   ├── AM-8.0.1.war<br>│   │   └── Amster-8.0.1.zip<br>│   ├── ds<br>│   │   └── DS-8.0.0.zip<br>│   ├── idm<br>│   │   └── IDM-8.0.0.zip<br>│   ├── ig<br>│   │   └── PingGateway-2025.3.0.zip<br>│   └── ui<br>│       ├── PlatformUI-8.0.1.0523.zip</pre><p><strong>Make all scripts executable</strong></p><pre># Make all scripts executable:<br>find . -name &quot;*.sh&quot; -type f -exec chmod +x {} +</pre><p><strong>Review configuration</strong></p><p>Review the environment file to ensure it matches your desired values. If you want to get things up and running fast, you do not have to change anything!</p><pre># Modify your environment properties (If required!)<br>#Ensure Product Versions are correct and all other values<br>#The Simplest method is leaving everything default and letting<br>#the setup script configure everything<br>vim platformconfig.env</pre><p><strong>Setup your server</strong></p><p>This script will completely setup all your prerequisites including:</p><ul><li>Installing and configure Tomcat</li><li>Installing JDK 21</li><li>Configure the software directory i.e /opt/tomcat</li></ul><pre># Run the script to configure your OS from scratch!<br>./misc/platform8-setup.sh</pre><p><strong>Install the entire platform!!!</strong></p><p>You will be asked to select your deployment type. File Based Config has some limitations in it’s functionality by design, so if you want full control select Directory Server option 2.</p><pre># run the install<br>./install_platform8.sh</pre><p>The guided wizard handles the rest.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FdYfuzVC6Hl0&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DdYfuzVC6Hl0&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FdYfuzVC6Hl0%2Fhqdefault.jpg&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/2cfd2301b23507000d1ca4e27cb2a228/href">https://medium.com/media/2cfd2301b23507000d1ca4e27cb2a228/href</a></iframe><h4>Production Considerations and Best Practices</h4><p>While the suite includes secure defaults and a functional end-to-end platform, this is a <strong>development-only instance</strong>. For production:</p><ul><li>Adopt a <strong>multi-server or distributed deployment</strong> for scalability and resilience.</li><li>Use <strong>custom TLS certificates</strong> from trusted CAs.</li><li>Implement <strong>network segmentation, firewall rules, and monitoring</strong>.</li><li>Ensure <strong>regular updates, patching, and security hardening</strong>.</li></ul><p>This suite serves as a <strong>reference baseline</strong>, but production setups should extend it into a <strong>hardened, enterprise-ready architecture</strong>.</p><h4>Conclusion</h4><p>The Platform 8 Installation Suite turns a complex manual setup into an automated, repeatable process. With full orchestration, flexible configurations, and secure defaults, it empowers teams to rapidly deploy an enterprise-grade identity platform.</p><p>Remember, this is a <strong>sample instance</strong> on a <strong>single Linux server</strong>, suited for <strong>development and evaluation only</strong>. For production, plan a <strong>multi-server or distributed deployment</strong> with scaling, hardening, and monitoring.</p><p>By merging Ping’s unified platform with smart automation, the suite lays a strong foundation for modern IAM, explore it in development today and scale to production tomorrow.</p><h4>References</h4><p><a href="https://www.pingidentity.com/en/resources/blog/post/iam-private-cloud-fabric.html">Ping Advanced Identity Software — Your IAM Private Cloud Fabric</a></p><p><a href="https://github.com/mark-nienaber/Platform8Install">Public Repository used in this article</a></p><p><a href="https://docs.pingidentity.com/platform/8/platform-guide/about.html">Ping Identity Platform Documentation</a></p><p><a href="https://docs.pingidentity.com/forgeops/2025.2/index.html">ForgeOps — K8 / Docker deployment of the the platform</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5db1748d348b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simplifying mTLS OAuth Client Authentication in PingAM]]></title>
            <link>https://marknienaber.medium.com/simplifying-mtls-oauth-client-authentication-in-pingam-c7239f08a813?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/c7239f08a813</guid>
            <category><![CDATA[ping-identity]]></category>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[openam]]></category>
            <category><![CDATA[mtls-authentication]]></category>
            <category><![CDATA[oauth]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Wed, 20 Aug 2025 05:44:27 GMT</pubDate>
            <atom:updated>2025-08-21T03:34:45.011Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>A scripted approach to configure and test mTLS OAuth Client Authentication</strong></h4><p><em>By Mark Nienaber — August 2025</em></p><h3>Introduction</h3><p>Configuring OAuth clients in PingAM is mostly straightforward, however, setting up mutual TLS (mTLS) authentication, with termination directly at Tomcat, can feel like navigating a maze of certificates, PKCS#12 bundles, and server.xml tweaks often punctuated by frustrating handshake errors.</p><p>To simplify this, I created <a href="https://github.com/mark-nienaber/pingam_mtlsclientauth"><strong>pingam_mtlsclientauth</strong></a>, a script that automates mTLS OAuth client setup for a local, on-premises PingAM 8.0x instance running on Tomcat 10.</p><p>This script focuses on self-signed certificates for ease of use, generating all necessary certificates and truststores, registering OAuth clients, and configuring Tomcat for mTLS termination.</p><p>A future update will extend support to mTLS with PKI infrastructure, but for now, this project is your go-to for quick, local experimentation with self-signed certificates.</p><p>In this article, I’ll explain why mTLS is valuable, how the script streamlines the setup, and how you can test it locally. Whether you’re learning OAuth, experimenting with PingAM, or preparing for secure deployments, this project is designed to make mTLS accessible.</p><h3>Why Mutual TLS?</h3><p>In OAuth 2.0, client authentication ensures only trusted clients access protected resources. The standard client_secret_basic method (client ID and secret) is simple but vulnerable if secrets are mishandled in config files or environment variables. Mutual TLS (mTLS), terminated directly at Tomcat in this setup, enhances security by requiring both client and server to present valid certificates.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/540/0*AGVVpzbT7WsBFKaK.jpeg" /></figure><p>Benefits include:</p><ul><li><strong>Two-way trust</strong>: The server verifies the client’s certificate, and the client verifies the server’s.</li><li><strong>No plaintext secrets</strong>: Certificates eliminate the need for easily exposed secret strings.</li><li><strong>Regulatory compliance</strong>: mTLS meets strict security standards for industries like finance and healthcare.</li></ul><p>This project demonstrates mTLS in action on a local PingAM 8.0x instance, using self-signed certificates for simplicity. For more details, see the PingAM OAuth 2.0 Client Authentication with mTLS guide.</p><h3>What the Script Does</h3><p>The <strong>setup-pingam-oauth-client.sh</strong> script is a menu-driven Bash tool that automates mTLS setup for PingAM 8.0x on Tomcat 10. It handles:</p><ol><li><strong>Generating self-signed certificates</strong>: Creates certificates and PKCS#12 bundles for mTLS.</li><li><strong>Creating a truststore</strong>: Produces a trustedclients.p12 file for Tomcat to validate client certificates.</li><li><strong>Registering OAuth clients</strong>: Sets up both a standard OAuth client and an mTLS client in PingAM.</li><li><strong>Testing authentication flows</strong>: Validates standard and mTLS flows with detailed curl exit code error-handling.</li><li><strong>Providing Tomcat configuration</strong>: Outputs a server.xml snippet for enabling SSL and mTLS termination.</li></ol><p>The interactive menu looks like this:</p><pre>PingAM OAuth Client Management<br>==============================<br>1. Delete existing clients (clientcredsapp, mtlsclient)<br>2. Generate certificates and create OAuth clients<br>3. Test OAuth clients authentication<br>4. Show Tomcat configuration instructions<br>5. Exit</pre><p>Designed for experimentation, the script lets you reset, recreate, and retest clients effortlessly. Learn more about PingAM’s mTLS configuration in the official documentation.</p><h3>Running mTLS Locally with Tomcat 10</h3><p>This project terminates mTLS directly at Tomcat 10, eliminating the need for external load balancers or proxies. It’s tailored for a local, on-premises PingAM 8.0x instance, using self-signed certificates to keep things simple. The script generates all certificates and provides a server.xml snippet for Tomcat 10.</p><p>Here’s a configuration example:</p><pre>&lt;Connector port=&quot;8443&quot;<br>           protocol=&quot;org.apache.coyote.http11.Http11NioProtocol&quot;<br>           SSLEnabled=&quot;true&quot;&gt;<br>    &lt;SSLHostConfig protocols=&quot;+TLSv1.3,+TLSv1.2&quot;<br>                   certificateVerification=&quot;optional&quot;<br>                   truststoreFile=&quot;conf/trustedclients.p12&quot;<br>                   truststorePassword=&quot;changeit&quot;<br>                   truststoreType=&quot;PKCS12&quot;&gt;<br>        &lt;Certificate certificateKeystoreFile=&quot;conf/am-server.jks&quot;<br>                     certificateKeystorePassword=&quot;changeit&quot;<br>                     certificateKeyAlias=&quot;am-server&quot;<br>                     type=&quot;RSA&quot; /&gt;<br>    &lt;/SSLHostConfig&gt;<br>&lt;/Connector&gt;</pre><p>The certificateVerification=”optional” setting in the SSLHostConfig is critical for this setup. It allows Tomcat to request a client certificate during the TLS handshake but does not mandate it. This flexibility is ideal for testing, as it supports both mTLS (where the client presents a certificate) and standard OAuth flows (where no client certificate is needed) on the same connector.</p><h3>Setup Steps</h3><ul><li>Run the script and select option 2 to generate self-signed certificates and the truststore and the new OAuth Clients:</li></ul><p>Step 2 will output the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nuYvo49TuLmRTWYC.png" /><figcaption>Output from certificate and clients creation</figcaption></figure><p>Your clients will be created in PingAM:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wGerUI9Je26_t5vA.png" /><figcaption>New clients created</figcaption></figure><p>Copy the generated trustedclients.p12 to your Tomcat 10 conf/ directory:<br>cp ./key/trustedclients.p12 $TOMCAT_HOME/conf/</p><ul><li>Update Tomcat’s server.xml with the provided snippet or adjust according to your environment.</li><li>Restart Tomcat 10 to enable mTLS termination.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KFEXCSl1fVaOncWvzcAbAQ.png" /><figcaption>Tomcat restarted</figcaption></figure><ul><li>Move on to Testing in the next option</li></ul><h3>Testing OAuth Clients</h3><p>With the setup complete, test two authentication flows:</p><ul><li><strong>Standard Client</strong>: Uses client ID and secret with HTTP Basic Auth.</li><li><strong>mTLS Client</strong>: Uses self-signed client certificate authentication, terminated at Tomcat.</li></ul><p>Select option 3 from the script’s menu to run the tests.<br>On success, you’ll see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QxgDbkxriMmH4EWy.png" /><figcaption>Tests succeeded</figcaption></figure><p>If issues arise, the script provides troubleshooting based on curl exit codes:</p><ul><li><strong>Code 7 (Connection refused)</strong>: Verify Tomcat 10 is running on port 8443.</li><li><strong>Codes 35, 51, 60 (SSL handshake failure)</strong>: Check the truststore in server.xml.</li><li><strong>Code 124 (Timeout)</strong>: Ensure the mTLS connector accepts client certificates.</li><li><strong>Code 58 (Client certificate issue)</strong>: Regenerate self-signed certificates using the script.</li></ul><h3>Clean Up</h3><p>Included in the script as Option 1 is the ability to clean up the existing clients created by this script, useful when testing a new certificate.</p><p>Once selected Option 1 will give the following output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*fvIDKjHTkBOrXaGe.png" /></figure><h3>Security Considerations</h3><p>This project is for <strong>development and testing</strong> on a local PingAM 8.0x instance, using self-signed certificates. Key notes:</p><ul><li><strong>Self-signed certificates</strong>: Suitable for demos but not production. A future update will add support for PKI-based certificates.</li><li><strong>Default passwords</strong>: Uses password and changeit for simplicity. Rotate these in production.</li><li><strong>Certificate validity</strong>: Set to 365 days. Adjust as needed for real deployments.</li></ul><p>For production, integrate with a CA-signed PKI, secure passwords, and harden Tomcat’s SSL settings. See the PingAM security guidelines for best practices.</p><h3>Why Use This Project?</h3><p>The <strong>pingam_mtlsclientauth</strong> project simplifies mTLS experimentation on PingAM 8.0x with Tomcat 10. It’s perfect for:</p><ul><li><strong>Learning</strong>: Understand mTLS hands-on with minimal setup.</li><li><strong>Prototyping</strong>: Test OAuth flows locally before scaling.</li><li><strong>Demos</strong>: Showcase mTLS termination for training or stakeholders.</li></ul><p>By automating certificate generation, client registration, and Tomcat configuration, it eliminates hours of manual debugging.</p><h3>Conclusion</h3><p>Setting up mTLS for OAuth clients in PingAM 8.0x doesn’t have to be intimidating. With <a href="https://github.com/mark-nienaber/pingam_mtlsclientauth"><strong>pingam_mtlsclientauth</strong></a>, you can configure and test mTLS authentication on a local Tomcat 10 instance in minutes, using self-signed certificates. A future update will add PKI support, but for now, this project is your hands-on guide to mastering mTLS locally.</p><p>Ready to dive in? Check out the <a href="https://github.com/mark-nienaber/pingam_mtlsclientauth">pingam_mtlsclientauth</a> repository and start experimenting.</p><p>Also check out <a href="https://medium.com/p/7d040bba7f0c"><strong>this</strong></a> great article on a scripted approach to setting up the JWT Bearer profile.</p><p>For more on PingAM’s mTLS capabilities, explore the <a href="https://docs.pingidentity.com/pingam/8/oauth2-guide/oauth2-client-auth.html">official documentation</a>.</p><p><em>Happy OAuthing, and stay secure!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c7239f08a813" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to configure SAML flows using an External Login UI in PingOne Advanced Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/how-to-configure-saml-flows-using-an-external-login-ui-in-pingone-advanced-identity-cloud-8be4e874f477?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/8be4e874f477</guid>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[aml]]></category>
            <category><![CDATA[login]]></category>
            <category><![CDATA[sso]]></category>
            <category><![CDATA[ping]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Tue, 17 Sep 2024 02:11:56 GMT</pubDate>
            <atom:updated>2024-09-17T02:11:56.893Z</atom:updated>
            <content:encoded><![CDATA[<h4>A step by step guide to configure SAML flow as using PingOne Advanced Identity Cloud as the IDP with an External Login UI</h4><p><strong>Note</strong>: This is an updated version of a previous article which focused on older versions of the products and simpler use cases, you can find that article <a href="https://medium.com/@marknienaber/forgerock-identity-cloud-as-a-saml-2-0-identity-provider-f88105fc295b">here</a>.</p><h3>Introduction</h3><p>Use of an External Login UI has become common place in PingOne Advanced Identity Cloud (AIC) solutions. This article guides you to configure AIC as the SAML IDP protecting an app with PingGateway as the SAML SP. The Login UI will be external and backed by the Ping SDK.</p><p>The aim is to address a number of commonly requested use cases:</p><h4>Use case 1: Use PingOne Advanced Identity Cloud as a SAML 2.0 IDP</h4><p>PingOne Advanced Identity Cloud can act as an SP or IDP. This use case focuses on configuration of PingOne Advanced Identity Cloud to act as the Identity Provider.</p><h4>Use case 2: Use PingGateway as a SAML 2.0 SP</h4><p>PingGateway can operate under various personas, offering protection for APIs, microservices, and both modern and legacy applications. PingGateway has even been referred to as a Swiss Army Knife due to its highly configurable nature to meet even the most complex use cases. PingGateway will be protecting an application and act as the SAML SP.</p><h4>Use case 3: Use an External Login UI backed by the SDK</h4><p>In cases where customers manage their own login page the SDK can be used to traverse the login journeys, get SSO tokens and Access Tokens. We will configure authentication via an external page for this SAML interaction.</p><p>While this article combines all of these use cases , they can be met individually and you can plug in both your own SP or IDP should that be required, and use either hosted pages or your own login page.</p><h3><strong>Glossary</strong></h3><p>The following terms are used in SAML and federation:</p><ul><li><em>Identity Provider</em> (IDP): The service that manages the user identity.</li><li><em>Service Provider</em> (SP): The service that a user wants to access. PingGateway acts as a SAML 2.0 SP for SSO, providing users with an interface to applications that don’t support SAML 2.0.</li><li><em>Circle of trust</em> (CoT): An IDP and SP that participate in the federation.</li></ul><p>The Following products are used in this integration:</p><ul><li>PingGateway (AIC)</li><li>PingOne Advanced Identity Cloud (AIC)</li><li>PingAM (AM), formally ForgeRock Access Management</li></ul><h3>Design your solution</h3><p>In this simple example, a Sample Application as well as PingGateway are running on a single Virtual Machine. Requests for the service are local and AIC (a SaaS product) is acting as the IDP sitting in Google Cloud Platform (GCP). The Login page with SDK is deployed locally as well. The following diagram illustrates the solution at a high level.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JKsQHHAEhkptHKlVWk1e7A.png" /><figcaption>Simplified Solution</figcaption></figure><p><strong>SP initiated SSO flow</strong></p><ol><li>End user accesses Sample App protected by PingGateway (SP)</li><li>PingGateway configured as a reverse proxy protecting the sample application at the following URL <a href="https://sp.example.com:9443/home">https://ig.example.com:9443/home</a>, the SAML Filter will direct the enduser to the configured IDP — AIC</li><li>User is redirected to IDP — AIC with an SAML Authentication Request</li><li>IDP is configured with an external Login URL so directs the user to the login page</li><li>User Authenticates to the login page using SDK to interact with AIC</li><li>On successful authentication, the login page redirects the user back to the IDP</li><li>The IDP redirects the user back to the SP with with a SAML Assertion</li><li>User is granted access to protected application through PingGateway</li></ol><p>The following URL’s are configured:</p><p><strong>PingGateway / SP</strong>: <a href="https://sp.example.com:9443/home">https://sp.example.com:9443/home</a></p><p><strong>Sample Application</strong> (direct): <a href="http://sample.example.com:8081/home">http://sample.example.com:8081/home</a></p><p><strong>AIC</strong> : <a href="https://openam-mytenant.forgerock.io/">https://openam-mytenant.forgerock.io</a></p><p><strong>Login Application</strong>: <a href="https://login.example.com:8443/">https://login.example.com:8443/</a></p><h3>Setup the network</h3><p>You’ll need to configure the /etc/hosts file on your PC/mac to reach PingGateway and sample application:</p><pre>127.0.0.1 sp.example.com sample.example.com login.example.com</pre><p>Nothing is needed for AIC as it’s a publicly accessible service, however if you are using a local AM installation you’ll need to configure that too.</p><h3>Configure the Fedlet</h3><p>PingAM provides a fedlet which you can read more about <a href="https://backstage.forgerock.com/docs/am/7.5/saml2-guide/saml2-implementation-fedlet.html">here</a>. The fedlet is a small Java app that adds federation capability to your application. The fedlet libraries are already included in PingGateway but in order to utilise these built in federation capabilities you need to get the configuration files from the fedlet.</p><p>A copy of configured fedlet files can be found <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/aicsamlwithexternallogin/browse">here</a>.</p><ol><li>Download the PingAM zip file from backstage — <a href="https://backstage.forgerock.com/downloads/browse/am/featured">https://backstage.forgerock.com/downloads/browse/am/featured</a></li></ol><p>2. Inside the package find and unzip the Fedlet-7.x.x.zip file</p><pre>$ unzip openam/Fedlet-7.5.0.zip<br> Archive: openam/Fedlet-7.5.0.zip<br> creating: conf/<br> inflating: README<br> inflating: conf/FederationConfig.properties<br> inflating: conf/fedlet.cot-template<br> inflating: conf/idp-extended.xml-template<br> inflating: conf/sp-extended.xml-template<br> inflating: conf/sp.xml-template<br> inflating: fedlet.war</pre><p>3. In the conf folder make the following replacements:</p><ul><li>IDP_ENTITY_ID replace with openam</li><li>FEDLET_ENTITY_ID replace with sp</li><li>FEDLET_PROTOCOL://FEDLET_HOST:FEDLET_PORT/FEDLET_DEPLOY_URI replace with <a href="https://sp.example.com:9443/saml">https://sp.example.com:9443/saml</a></li><li>fedletcot and FEDLET_COT replace with Circle of Trust</li><li><a href="https://sp.example.com:9443/saml/fedletapplication:">https://sp.example.com:9443/saml/fedletapplication</a> replace with <a href="https://sp.example.com:9443/saml/fedletapplication/metaAlias/sp">https://sp.example.com:9443/saml/fedletapplication/metaAlias/sp</a></li></ul><p>The full steps of configuring Identity Gateway as a SAML 2.0 IDP can be found <a href="https://backstage.forgerock.com/docs/am/7.5/saml2-guide/saml2-implementation-fedlet.html">here</a>.</p><p>4. Remove all the *-template extensions from the files which means you are now left with:</p><pre>$ tree -l conf<br>conf<br>├── FederationConfig.properties<br>├── fedlet.cot<br>├── idp-extended.xml<br>├── sp-extended.xml<br>└── sp.xml</pre><p>A copy of the files with this article’s configuration can be found <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/aicsamlwithexternallogin/browse">here</a>.</p><h3>Configure AIC</h3><h4>Create a test user</h4><p>Log in to your AIC Console and browse to <em>Identities</em> -&gt; <em>Manage</em> -&gt; <em>Alpha realm — Users</em> then click <em>+New Alpha realm — User</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*gHRj2KUheDYRTEcsWu9CUQ.png" /><figcaption>Creating new user</figcaption></figure><p>Create a new user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/685/1*6_QSmbfKZbJo68zT6wQcoA.png" /><figcaption>New user example</figcaption></figure><p>Now the user is configured let’s check you can login by authenticating to the Alpha realm.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*aczeaFbJuMvDV5q5UYjUWQ.png" /><figcaption>Login with new user</figcaption></figure><p>Because the Enduser UI is enabled and is the default landing page the welcome message is displayed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*jemH2gmsWWtvKzRsPuyTHw.png" /><figcaption>Enduser UI Logged in</figcaption></figure><h4>Configure Federation</h4><p>Login to AIC as a tenant administrator and browse to <em>Native Consoles</em> -&gt; <em>Access Management</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*xukyCdw4lQ9UxCAy_-zvuw.png" /><figcaption>AM Native Console</figcaption></figure><p>In the Access Management console, browse to <em>Applications</em> -&gt; <em>Federation</em> -&gt; <em>Circles of Trust</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*DsFDbMajKlA9HkHuaGIDow.png" /><figcaption>Circles of Trust</figcaption></figure><p>Choose a name that suits, this example uses <em>Circle of Trust</em> which has been configured in the above fedlet configuration files. Enter the name and press <em>Create</em>. Leave all other fields as their default.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/719/1*D9bKsDT-5v1rreCzcw-SKw.png" /><figcaption>New Circle of Trust</figcaption></figure><h4>Setup the Service Provider</h4><p>The service provider details have already been configured in the above <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/identitygatewaysamlsp/browse/conf/sp.xml"><em>sp.xml</em></a><em>. </em>This is imported in subsequent steps into AIC as a Remote Service Provider.</p><p>Browse to <em>Applications</em> -&gt; <em>Federation</em> -&gt; <em>Entity providers</em> -&gt; <em>Add Entity Provider </em>and select <em>Remote</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*qSKBBVOQMZX4lhQVE7rlhg.png" /><figcaption>Entity Providers</figcaption></figure><p>In the <em>New Remote Entity Provider</em> page, drag and drop your <em>sp.xml</em> then select your <em>Circle of Trust</em> and press <em>Create.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/731/1*WruI6Es9SGOJfDTFZk4T2A.png" /><figcaption>New SP Entity</figcaption></figure><p>Your SP entity named <em>sp</em> will appear on your list of <em>Entity Providers.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*0lX3XZbvRuhWt3U7nXJYMQ.png" /><figcaption>Newly created SP</figcaption></figure><p>Your SP is now configured, the next task is to configure the IDP.</p><h4>Configure your Identity Provider.</h4><p>The following steps configures AIC as the Hosted Identity Provider. Browse to <em>Applications</em> -&gt; <em>Federation</em> -&gt; <em>Entity Providers</em> -&gt; <em>Add Entity Provider</em> -&gt; <em>Hosted.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/889/1*GBPNm0SBSQ6PvZ9-ph-PEw.png" /><figcaption>Create hosted IDP</figcaption></figure><p>Enter <em>openam</em> as the <em>Entity ID</em> and <em>idp</em> as the <em>Identity Provider Meta Alias</em>, and select the correct <em>Circles of Trust</em>, then press <em>Create.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/886/1*rlJhuoqD04l7wQBQPnL-GA.png" /><figcaption>New Hosted Entity Provider</figcaption></figure><p>Do the following to add the attributes to your assertion. Firstly configure <em>cn</em> by browsing to your IDP, then to <em>Assertion Processing</em> -&gt; <em>Attribute Mapper</em> -&gt; <em>Attribute Map</em>. Enter the following and then click <em>Add</em>:</p><p><em>SAML Attribute = cn, Local Attribute = cn</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*7jaufosOKb6JIlEU6uZmLQ.png" /><figcaption>Attribute Mapper</figcaption></figure><p>Do the same thing with <em>sn</em> and <em>mail</em> i.e.</p><p><em>SAML Attribute</em> = <em>sn</em>, <em>Local Attribute</em> = <em>sn</em></p><p>After this is completed your <em>Attribute Map</em> will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*EuDYKYC5ASG3zDMevyFx8w.png" /><figcaption>Completed Attribute Mapper</figcaption></figure><p>Now click <em>Save Changes</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/740/1*3D1yOJycbwmF5icub9Rnpg.png" /><figcaption>Don’t forget to Save!</figcaption></figure><h4>Export your IDP settings.</h4><p>You will need to export the IDP settings and provide them to the Service Provider.</p><p>Execute the following curl command to export the IDP settings:</p><p>curl -v --output idp.xml “<a href="https://openam-nienaber-aaltest2.forgeblocks.com/am/saml2/jsp/exportmetadata.jsp?entityid=openam&amp;realm=/alpha">https://openam-mytenant.forgerock.io/am/saml2/jsp/exportmetadata.jsp?entityid=openam&amp;realm=/alpha</a>&quot;</p><p>The idp.xml file will be saved locally, copy this to the fedlet conf directory so the list of files contained look like below:</p><p>$ tree -l conf/<br>conf/<br>├── FederationConfig.properties<br>├── fedlet.cot<br>├── idp-extended.xml<br>├── idp.xml<br>├── sp-extended.xml<br>└── sp.xml</p><h3>Configure PingGateway</h3><p>You can use an existing PingGateway Deployment or install (Unzip) a new instance.</p><p>[fradmin@centosbase G]$ unzip ../PingGateway-2024.6.0.zip<br>Archive: ../PingGateway-2024.6.0.zip<br> creating: identity-gateway-2024.6.0/<br> creating: identity-gateway-2024.6.0/legal-notices/<br> creating: identity-gateway-2024.6.0/legal-notices/third-party-licenses/<br> creating: identity-gateway-2024.6.0/bin/<br> creating: identity-gateway-2024.6.0/classes/<br> creating: identity-gateway-2024.6.0/docker/<br> creating: identity-gateway-2024.6.0/lib/</p><p>Your PingGateway deployment will consist of two important locations:</p><ol><li>The install directory i.e. /opt/identity-gateway-2024.6.0</li><li>The config directory by default is “.openig” in your home directory i.e /home/fradmin/.openig</li></ol><h4>Setup SAML folder with fedlet files</h4><p>In the PingGateway configuration directory i.e. /home/fradmin/.openig, create a directory named <em>SAML</em> at the same level as the <em>config</em> folder (Not IN the config folder). Move all the configured fedlet files into this SAML folder i.e.</p><pre>/home/fradmin/.openig<br>[fradmin@centosbase .openig]$ tree -L 2<br>.<br>├── config<br>│ ├── admin 1.json<br>│ ├── admin.json<br>│ ├── logback.xml<br>│ └── routes<br>├── logs<br>│ ├── route-saml-filter.log<br>│ ├── route-saml.log<br>│ ├── route-static-resources.log<br>│ └── route-system.log<br>├── SAML<br>│ ├── FederationConfig.properties<br>│ ├── fedlet.cot<br>│ ├── idp-extended.xml<br>│ ├── idp.xml<br>│ ├── sp-extended.xml<br>│ └── sp.xml<br>├── scripts<br>│ └── groovy<br>└── tmp</pre><p>A copy of all pre-configured files for my environment can be found <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/aicsamlwithexternallogin/browse">here</a>.</p><h4>Remove BaseURI</h4><p>If you have a config.json file setup, remove the baseURI. The SamlFederationHandler must not be rebased as the URI must match the endpoint in the SAML metadata.</p><h4>Allow static resources to pass through</h4><p>Add a route to pass through css and other resources for your sample application. To do this create a file named <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/aicsamlwithexternallogin/browse/config/routes/static-resources.json">static-resources.json</a> with the content below and place this into your routes folder i.e.</p><pre>{<br>  &quot;name&quot; : &quot;00-static-resources&quot;,<br>  &quot;baseURI&quot; : &quot;http://sample.example.com:8081&quot;,<br>  &quot;condition&quot;: &quot;${find(request.uri.path,&#39;^/css&#39;) or matchesWithRegex(request.uri.path, &#39;^/.*\\\\.ico$&#39;) or matchesWithRegex(request.uri.path, &#39;^/.*\\\\.gif$&#39;)}&quot;,<br>  &quot;handler&quot;: &quot;ReverseProxyHandler&quot;<br>}</pre><h4>Configure SamlFederationFilter</h4><p>Add a saml route to configure the SamlFederationFilter by creating a file named <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/aicsamlwithexternallogin/browse/config/routes/saml-filter.json">saml-filter.json</a> and placing it in the routes folder i.e.</p><pre>{<br>    &quot;name&quot;: &quot;saml-filter&quot;,<br>    &quot;baseURI&quot;: &quot;http://sample.example.com:8081&quot;,<br>    &quot;condition&quot;: &quot;${find(request.uri.path, &#39;^/home&#39;)}&quot;,<br>    &quot;handler&quot;: {<br>      &quot;type&quot;: &quot;Chain&quot;,<br>      &quot;config&quot;: {<br>        &quot;filters&quot;: [<br>          {<br>            &quot;name&quot;: &quot;SamlFilter&quot;,<br>            &quot;type&quot;: &quot;SamlFederationFilter&quot;,<br>            &quot;config&quot;: {<br>              &quot;assertionMapping&quot;: {<br>                &quot;name&quot;: &quot;cn&quot;,<br>                &quot;surname&quot;: &quot;sn&quot;<br>              },<br>              &quot;subjectMapping&quot;: &quot;sp-subject-name&quot;,<br>              &quot;redirectURI&quot;: &quot;/home/saml-filter&quot;<br>            }<br>          },<br>          {<br>            &quot;name&quot;: &quot;SetSamlHeaders&quot;,<br>            &quot;type&quot;: &quot;HeaderFilter&quot;,<br>            &quot;config&quot;: {<br>              &quot;messageType&quot;: &quot;REQUEST&quot;,<br>              &quot;add&quot;: {<br>                &quot;x-saml-cn&quot;: [ &quot;${toString(session.name)}&quot; ],<br>                &quot;x-saml-sn&quot;: [ &quot;${toString(session.surname)}&quot; ]<br>              }<br>            }<br>          }<br>        ],<br>        &quot;handler&quot;: &quot;ReverseProxyHandler&quot;<br>      }<br>    }<br>  }</pre><p>In this route maps the values returned in the assertion to be stored in PingGateway’s session context, i.e. cn from the assertion is mapped to session.name.</p><p><strong>Notice</strong> that when the HeaderFilter adds headers x-saml-cn and x-saml-sn to the request they are easily reference by the attribute name in the session context i.e. ${toString(session.name)}.</p><p>The filter then allows the ReverseProxyHandler to do it’s job and communicate with the protected application.</p><h3>Run Sample Application</h3><p>Follow the steps here to download, configure and run a SDK backed sample application. We will be running the Embedded login sample provided in this repository.</p><p><a href="https://github.com/ForgeRock/sdk-sample-apps">GitHub - ForgeRock/sdk-sample-apps: Repo containing all the SDK sample apps</a></p><p>Note the following:</p><h4>Modify the URL of the login app</h4><p>Locate the sdk-sample-apps/blob/main/embedded-login/webpack.config.js file and set the host:</p><pre>devServer: {<br>    port: 8443,<br>    host: &#39;login.example.com&#39;,</pre><p>Run embedded-login sample app:</p><pre>npm run start:embedded-login<br><br>&gt; forgerock-sdk-samples@1.0.0 start:embedded-login<br>&gt; npm start --workspace embedded-login<br><br><br>&gt; embedded-login@1.0.0 start<br>&gt; webpack serve<br><br>(node:74445) [DEP_WEBPACK_DEV_SERVER_HTTPS] DeprecationWarning: &#39;https&#39; option is deprecated. Please use the &#39;server&#39; option.<br>(Use `node --trace-deprecation ...` to show where the warning was created)<br>&lt;i&gt; [webpack-dev-server] SSL certificate: /Users/mark.nienaber/Documents/ForgeRock/GIT/sdk-sample-apps/embedded-login/node_modules/.cache/webpack-dev-server/server.pem<br>&lt;i&gt; [webpack-dev-server] Project is running at:<br>&lt;i&gt; [webpack-dev-server] Server: https://login.example.com:8443/<br>&lt;i&gt; [webpack-dev-server] Loopback: https://127.0.0.1:8443/<br>webpack 5.89.0 compiled successfully in 1290 ms</pre><p>The following login page (or similar) should be displayed:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/460/1*m8Ht1oOyDnfgUVtuqUMy2w.png" /><figcaption>Sample Login Page</figcaption></figure><p>If working successfully after logging in you should be presented with the user information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*RAY_v1Sz_T-AuAKRBWEVRA.png" /><figcaption>Successful Login</figcaption></figure><p><strong>Ensure Login App respects the SAML redirect back to the IDP</strong></p><p>Modify (if necessary) the login app to respect the goto URL back to the IDP, i.e.</p><p>Inside sdk-sample-apps/blob/main/embedded-login/src/main.js make sure on successful authentication if there is a goto url then proceed there:</p><pre>case &#39;LoginSuccess&#39;: {<br>            // If a goto URL param was captured, then redirect as this is a Custom Login Page flow<br>            const urlParams = new URLSearchParams(window.location.search);<br>            const gotoUrl = urlParams.get(&#39;goto&#39;);<br>      <br>            if (gotoUrl) {<br>              window.location.href = gotoUrl; // Redirect to the goto URL<br>              return; // Exit early to avoid running the code below<br>            }<br><br>        // If we have a session token, get user information<br>        const sessionToken = step.getSessionToken();<br>        const tokens = await forgerock.TokenManager.getTokens();<br>        const user = await forgerock.UserManager.getCurrentUser();<br>        return showUser(user);<br><br>    }</pre><p><strong>Modify the IDP to use the external login app</strong></p><p>Browse to the Native Access Management Console, then <em>Applications</em>, <em>Entity Providers</em> then <em>openam</em>. Then browse to the <em>Assertion Processing</em> tab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*eYGgefwgDG5qpnA7vUvYaQ.png" /><figcaption>IDP login page setup</figcaption></figure><p>At the bottom of the page enter the login page URL under <em>Auth URL</em>, in my case <a href="https://login.example.com:8443/">https://login.example.com:8443/</a> then <em>press Save Changes</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Cly-62BpK9xsowIW4eobhQ.png" /><figcaption>Save Changes</figcaption></figure><p>The setup should now be complete and is now ready to test!</p><h3>Test the Setup:</h3><p>Browse to<a href="https://sp.example.com:9443/home/federate">https://sp.example.com:9443/home</a> which is detected by our saml-filter route and handled by the SamlFederationFilter.</p><p>This is redirected to the IDP with a SAML Authentication Request:</p><p><a href="https://openam-mytenant.forgerock.io/">https://openam-blah.forgeblocks.com</a>/am/SSORedirect/metaAlias/alpha/idp?SAMLRequest=xxxxxxxx</p><p>The Authentication request looks similar to:</p><pre>&lt;samlp:AuthnRequest xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot;<br>                    AssertionConsumerServiceURL=&quot;https://sp.example.com:9443/home/saml/fedletapplication/metaAlias/sp&quot;<br>                    Destination=&quot;https://openam-blah.forgeblocks.com/am/SSORedirect/metaAlias/alpha/idp&quot;<br>...<br>                    ProtocolBinding=&quot;urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST&quot;<br>                    Version=&quot;2.0&quot;<br>                    &gt;<br>    &lt;saml:Issuer xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;&gt;sp&lt;/saml:Issuer&gt;<br>    &lt;samlp:NameIDPolicy AllowCreate=&quot;true&quot;<br>                        Format=&quot;urn:oasis:names:tc:SAML:2.0:nameid-format:transient&quot;<br>                        SPNameQualifier=&quot;sp&quot;<br>                        /&gt;<br>...<br>        &lt;saml:AuthnContextClassRef&gt;urn:oasis:names:tc:SAML:2.0:ac:classes:PasswordProtectedTransport&lt;/saml:AuthnContextClassRef&gt;<br>    &lt;/samlp:RequestedAuthnContext&gt;<br>&lt;/samlp:AuthnRequest&gt;</pre><p>You are directed to our IDP, which is configured to redirect you to the External Login Page. Login with your sample user:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/701/1*-FST_GFEvCj259iK2PUG3w.png" /><figcaption>Login to your IDP</figcaption></figure><p><strong>Note</strong> the login page url is appended by the goto url to continue the SAML flow, back with the IDP.</p><p>https://login.example.com:8443/?spEntityID=sp&amp;goto=<a href="https://openam-mytenant.forgerock.io/">https://openam-blah.forgeblocks.com</a>:443/am/saml2/continue/metaAlias/alpha/idp?secondVisitUr…..</p><p>The Login UI will need to redirect the user back to the IDP to continue the SAML flow. If configured correctly after authentication we are directed back to the IDP, and then back to the SP with the appropriate assertion.</p><p>The SAML assertion will contain the relevant information i.e. cn and sn.</p><pre>&lt;samlp:Response xmlns:samlp=&quot;urn:oasis:names:tc:SAML:2.0:protocol&quot;<br>                Destination=&quot;https://sp.example.com:9443/home/saml/fedletapplication/metaAlias/sp&quot;<br>...<br>    &lt;saml:Issuer xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;&gt;openam&lt;/saml:Issuer&gt;<br>    &lt;samlp:Status&gt;<br>        &lt;samlp:StatusCode Value=&quot;urn:oasis:names:tc:SAML:2.0:status:Success&quot; /&gt;<br>    &lt;/samlp:Status&gt;<br>    &lt;saml:Assertion xmlns:saml=&quot;urn:oasis:names:tc:SAML:2.0:assertion&quot;<br>                    ID=&quot;s2aab755b6662440c2e2c264235e3b065ec1e42627&quot;<br>                    IssueInstant=&quot;2024-09-13T04:51:04Z&quot;<br>                    Version=&quot;2.0&quot;<br>                    &gt;<br>        &lt;saml:Issuer&gt;openam&lt;/saml:Issuer&gt;<br>        ...<br>        &lt;saml:Subject&gt;<br>            &lt;saml:NameID Format=&quot;urn:oasis:names:tc:SAML:2.0:nameid-format:transient&quot;<br>                         NameQualifier=&quot;openam&quot;<br>                         SPNameQualifier=&quot;sp&quot;<br>                         &gt;Ynyc7QPe6BcuhwzEImNclBbVnxv7&lt;/saml:NameID&gt;<br>        ...    <br>        &lt;saml:AttributeStatement&gt;<br>            &lt;saml:Attribute Name=&quot;cn&quot;&gt;<br>                &lt;saml:AttributeValue xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>                                     xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>                                     xsi:type=&quot;xs:string&quot;<br>                                     &gt;Amy Carter&lt;/saml:AttributeValue&gt;<br>            &lt;/saml:Attribute&gt;<br>            &lt;saml:Attribute Name=&quot;sn&quot;&gt;<br>                &lt;saml:AttributeValue xmlns:xs=&quot;http://www.w3.org/2001/XMLSchema&quot;<br>                                     xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br>                                     xsi:type=&quot;xs:string&quot;<br>                                     &gt;Carter&lt;/saml:AttributeValue&gt;<br>            &lt;/saml:Attribute&gt;<br>        &lt;/saml:AttributeStatement&gt;<br>    &lt;/saml:Assertion&gt;<br>&lt;/samlp:Response&gt;</pre><p>PingGateway verifies the assertion, and redirects you to the protected application, inserting the relevant headers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*qQt8lzjDVn7svq2wNusACQ.png" /><figcaption>Protected app with headers</figcaption></figure><p>Congratulations you are done :)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8be4e874f477" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dynamically set access token expiry in Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/dynamically-set-access-token-expiry-in-identity-cloud-cb14a9a49608?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb14a9a49608</guid>
            <category><![CDATA[customization]]></category>
            <category><![CDATA[access-token]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[ping]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Fri, 09 Feb 2024 05:29:54 GMT</pubDate>
            <atom:updated>2024-02-12T01:13:28.978Z</atom:updated>
            <content:encoded><![CDATA[<p>PingOne Advanced Identity Cloud (Formally ForgeRock Identity Cloud) provides the ability to customise the access token expiry time through simple JavaScript</p><p>This was not always the case!</p><p>Back in ancient times, setting access token expiry time was a static affair. The value was configured in the Authorization Server Provider settings, or on the OAuth Client settings, and that was the value you got. Strategies to get access tokens with different expiry times included using different clients to get access tokens of different expiry times.</p><p>Not anymore!</p><p>This article will describe the steps to achieve this use case:</p><blockquote>As a client I need to get an access token on behalf of a user. The length of expiry of the token should based on the level of authentication. i.e. If the user authenticates with MFA — Token Expiry 10 minutes, If the user authenticates without MFA — Token Expiry 1 minutes</blockquote><p>We will be using the Authorization Code Grant type as described <a href="https://backstage.forgerock.com/docs/idcloud/latest/am-oauth2/oauth2-authz-grant.html#the_authorization_code_grant_flow">here</a> allowing use to get an Access Token.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*Gukp10sMlRnZWoOy89LeAw.png" /></figure><p>Let’s get this set up!</p><h3>Configure Journeys</h3><p><strong>LoginBasic</strong></p><p>This simple journey, as seen below, does not set Auth Level so by default the Auth Level will be 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*XI3ifqhSPt2PhCs0Uge83Q.png" /><figcaption>Basic Login Journey</figcaption></figure><p><strong>LoginMFA</strong></p><p>This journey will include a node to add + 100 to the Auth Level. After successfully traversing the journey you will have a session with an Auth Level of 100. In your environment this will likely be more complex with MFA nodes, however for simplicity we will just ensure the Auth Level is set correctly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uJqtMziE49uW6OCopZUdIw.png" /></figure><h3>Create Access Token Modification Script</h3><p>This script will be set on the client and run on token minting. This script will set the token expiry based on the Auth Level of the Authentication Session.</p><p>In the Platform UI go to <strong>Scripts</strong> &gt; <strong>Auth Scripts</strong>, then <strong>Duplicate</strong> the <strong>Alpha OAuth2 Access Token Modification Script</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*LFJy2cQvuWawbHbwlRcBtA.png" /></figure><p>Give the Script a name that’s relevant, in this example it’s <strong>Dynamic expiry OAuth2 Access Token Modification Script</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/438/1*HUDb2wCj7IL3nxnqP2h0OQ.png" /></figure><p>Now let’s add in the relevant script</p><pre>(function () {<br>  if(accessToken.getField(&quot;auth_level&quot;)&lt;99){<br>            //logger.error(&#39;&gt;&gt;&gt;&gt;&gt;&gt;&gt;. AUTHLEVEL = &lt; 99 &#39; + session.getAuthLevel());<br>            var currentDate = new Date();<br>            // Add one minute (60 seconds) to the current time<br>            var oneMinuteLater = new Date(currentDate.getTime() + 60000);<br>            // Get the Unix timestamp (seconds since January 1, 1970)<br>            var unixTimestampOneMinuteLater = Math.floor(oneMinuteLater.getTime() / 1000);<br>            //logger.error(&#39;&gt;&gt;&gt;&gt;&gt;&gt;&gt;. currentDate=&#39; + currentDate);<br>            //logger.error(&#39;&gt;&gt;&gt;&gt;&gt;&gt;&gt;. oneMinuteLater=&#39; + oneMinuteLater);<br>            //logger.error(&#39;&gt;&gt;&gt;&gt;&gt;&gt;&gt;. unixTimestampOneMinuteLater=&#39; + unixTimestampOneMinuteLater);<br>            accessToken.setField(&quot;exp&quot;, unixTimestampOneMinuteLater);<br>    }<br>}());</pre><p>You’ll note above that if the auth level less than 99 then the expiry time will be set to 1 minute.</p><p>This is done using the ‘exp’ field as noted in <a href="https://www.rfc-editor.org/rfc/rfc7519#section-4.1.4">RFC7519</a></p><blockquote>The “exp” (expiration time) claim identifies the expiration time on<br> or after which the JWT MUST NOT be accepted for processing. The<br> processing of the “exp” claim requires that the current date/time<br> MUST be before the expiration date/time listed in the “exp” claim.</blockquote><h3>Create OAuth Application</h3><p>You can do this manually or via REST. Just make sure you the client has the following settings:</p><ul><li><strong>Grant Type</strong> = authorization_code</li><li><strong>Token Endpoint Authentication</strong>=client_secret_post</li><li><strong>Allow Implied Consent</strong> = true</li></ul><p>All other settings are up to you. Sample REST call:</p><pre>curl --location &#39;https://URL/am/json/realms/alpha/agents/?_action=create&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--header &#39;&lt;cookie_name&gt;: &lt;Admin SSO Session&gt;&#39; \<br>--header &#39;Accept-API-Version: resource=3.0, protocol=1.0&#39; \<br>--data &#39;{<br>    &quot;username&quot;: &quot;myClient&quot;,<br>    &quot;userpassword&quot;: &quot;password&quot;,<br>    &quot;realm&quot;: &quot;/&quot;, <br>    &quot;AgentType&quot;: [&quot;OAuth2Client&quot;],<br>    &quot;com.forgerock.openam.oauth2provider.jwtTokenLifeTime&quot;: &quot;60&quot;,<br>    &quot;com.forgerock.openam.oauth2provider.grantTypes&quot;: [<br>        &quot;[1]=password&quot;,<br>        &quot;[4]=client_credentials&quot;,<br>        &quot;[0]=authorization_code&quot;,<br>        &quot;[3]=implicit&quot;,<br>        &quot;[2]=refresh_token&quot;<br>    ],<br>    &quot;com.forgerock.openam.oauth2provider.scopes&quot;: [ <br>        &quot;[0]=email&quot;, <br>        &quot;[1]=openid&quot;, <br>        &quot;[2]=profile&quot;, <br>        &quot;[2]=myemail&quot;, <br>        &quot;[2]=privileged&quot;<br>    ],<br>    &quot;com.forgerock.openam.oauth2provider.tokenEndPointAuthMethod&quot;: [<br>        &quot;client_secret_post&quot;<br>    ],<br>    &quot;com.forgerock.openam.oauth2provider.redirectionURIs&quot;: [<br>        &quot;[0]=http://www.google.com&quot;<br>    ],<br>     &quot;com.forgerock.openam.oauth2provider.requestObjectSigningAlg&quot;: [<br>         &quot;HS256&quot;<br>     ],<br>    &quot;isConsentImplied&quot;: [<br>        &quot;true&quot;<br>    ],<br>    &quot;com.forgerock.openam.oauth2provider.claims&quot;: [<br>        &quot;[0]=email&quot;,<br>        &quot;[1]=profile&quot;<br>    ]<br>}&#39;</pre><h3>Attach the Custom Script to OAuth Application</h3><p>Let’s set the overrides on the OAuth Application so it uses our custom script.</p><p>Browse to the Native AM console. <strong>Native Consoles</strong> &gt; <strong>Access Management</strong>, then browse to <strong>Applications</strong> &gt; <strong>OAuth 2.0</strong> &gt; <strong>Clients</strong> &gt; <strong>OAuth2 Provider Overrides</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BC3Xf952fk40NUHo2JsbTg.png" /></figure><p>Ensure the following is set:</p><ul><li><strong>Enable OAuth2 Provider Overrides</strong> = TRUE</li><li><strong>Access Token Modification Plugin Type</strong> = SCRIPTED</li><li><strong>Access Token Modification Script</strong> = Dynamic expiry OAuth2 Access Token Modification Script (or whatever you called your script)</li><li><strong>Allow Clients to Skip Consent</strong> = TRUE (I’m using Postman for testing so I’ll skip this)</li><li><strong>Use Client-Side Access &amp; Refresh Tokens</strong> = TRUE (<strong>Note</strong>: without this value set, the introspect endpoint doesn’t return the “expires_in” value which makes this hard to verify/test)</li></ul><h3>Testing</h3><p>Let’s Check the results:</p><h4><strong>Privileged Session.</strong></h4><p><strong>Expectation:</strong> Auth Level will be 100, and the expiry to be default i.e in this environment it’s 3600 seconds</p><p>Authenticate to <strong>LoginMFA</strong> Journey to get user</p><pre>curl --location --request POST &#39;https://URL/am/json/alpha/authenticate?authIndexType=service&amp;authIndexValue=LoginMFA&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--header &#39;Accept-API-Version: resource=2.1&#39;</pre><p>Request Access token from Authorize endpoint passing in the authenticated session from above as a Cookie</p><pre>curl --location &#39;https://URL/am/oauth2/realms/alpha/authorize?response_type=code&amp;client_id=myClient&amp;redirect_uri=http%3A%2F%2Fwww.google.com&amp;state=abc123&amp;scope=profile&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--header &#39;Cookie: e3307ef392bc9ba=Felzsl2IWBytu2epAyUx7yYERgM.*AAJTSQACMDIAAlNLABxidWM5K0xaMVhac3RRWkRUY1UvdHViTHc4TWs9AAR0eXBlAANDVFMAAlMxAAIwMQ..*&#39;</pre><p>Swap the Code for a token</p><pre>curl --location &#39;https://URL/am/oauth2/realms/alpha/access_token&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--data-urlencode &#39;grant_type=authorization_code&#39; \<br>--data-urlencode &#39;code=lL2WKHEd4Pl5Q11HomEC5XKGrBU&#39; \<br>--data-urlencode &#39;client_id=myClient&#39; \<br>--data-urlencode &#39;client_secret=password&#39; \<br>--data-urlencode &#39;redirect_uri=http://www.google.com&#39;</pre><p>My tokens are returned</p><pre>{<br>    &quot;access_token&quot;: &quot;&lt;token&gt;&quot;,<br>    ..<br>    &quot;expires_in&quot;: 3599<br>}</pre><p>And Decoded:</p><pre>{<br>  &quot;sub&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>  &quot;cts&quot;: &quot;OAUTH2_STATELESS_GRANT&quot;,<br>  &quot;auth_level&quot;: 100,<br>  &quot;auditTrackingId&quot;: &quot;cd24c749-c6cd-47fa-9d72-1e1891323c8d-2023959&quot;,<br>  &quot;subname&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>  &quot;iss&quot;: &quot;https://URL:443/am/oauth2/alpha&quot;,<br>  &quot;tokenName&quot;: &quot;access_token&quot;,<br>  &quot;token_type&quot;: &quot;Bearer&quot;,<br>  &quot;authGrantId&quot;: &quot;P5OyhcKUEkt-43Nru-a98kk_9CE&quot;,<br>  &quot;aud&quot;: &quot;myClient&quot;,<br>  &quot;nbf&quot;: 1707451669,<br>  &quot;grant_type&quot;: &quot;authorization_code&quot;,<br>  &quot;scope&quot;: [<br>    &quot;profile&quot;<br>  ],<br>  &quot;auth_time&quot;: 1707451362,<br>  &quot;realm&quot;: &quot;/alpha&quot;,<br>  &quot;exp&quot;: 1707455269,<br>  &quot;iat&quot;: 1707451669,<br>  &quot;expires_in&quot;: 3600,<br>  &quot;jti&quot;: &quot;-I7npoHsP7-QHNE92gVBa6bNhqw&quot;<br>}</pre><p>Let’s hit the introspect endpoint and check the results</p><pre>curl - location &#39;https://URL/am/oauth2/realms/alpha/introspect&#39; \<br> - header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br> - data-urlencode &#39;token=HwaPIB8pdLfyiXOoryQHYivYgMo&#39; \<br> - data-urlencode &#39;client_id=myClient&#39; \<br> - data-urlencode &#39;client_secret=password&#39;</pre><p>The Response:</p><pre>{<br>    &quot;active&quot;: true,<br>    &quot;scope&quot;: &quot;profile&quot;,<br>    &quot;realm&quot;: &quot;/alpha&quot;,<br>    &quot;client_id&quot;: &quot;myClient&quot;,<br>    &quot;user_id&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;username&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;token_type&quot;: &quot;Bearer&quot;,<br>    &quot;exp&quot;: 1707455269,<br>    &quot;sub&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;iss&quot;: &quot;https://URL:443/am/oauth2/alpha&quot;,<br>    &quot;subname&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;auth_level&quot;: 100,<br>    &quot;authGrantId&quot;: &quot;P5OyhcKUEkt-43Nru-a98kk_9CE&quot;,<br>    &quot;auditTrackingId&quot;: &quot;cd24c749-c6cd-47fa-9d72-1e1891323c8d-2023959&quot;,<br>    &quot;expires_in&quot;: 3593<br>}</pre><p>Notice that the “exp” time is set which affects the “expires_in” that’s correctly set to 3593</p><h4>LoginBasic Journey</h4><p><strong>Expectation</strong>: Auth Level will be 0, so our expectation is the token expires in 1 minute / 60 seconds.</p><p>Authenticate to LoginBasic Journey to get user</p><pre>curl --location --request POST &#39;https://URL/am/json/alpha/authenticate?authIndexType=service&amp;authIndexValue=LoginBasic&#39; \<br>--header &#39;Content-Type: application/json&#39; \<br>--header &#39;Accept-API-Version: resource=2.1&#39;</pre><p>Request Access token from Authorize endpoint passing in the authenticated session from above as a Cookie</p><pre>curl --location &#39;https://URL/am/oauth2/realms/alpha/authorize?response_type=code&amp;client_id=myClient&amp;redirect_uri=http%3A%2F%2Fwww.google.com&amp;state=abc123&amp;scope=profile&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--header &#39;Cookie: e3307ef392bc9ba=&lt;SSOToken&gt;&#39;</pre><p>Swap the Code for a token</p><pre>curl --location &#39;https://URL/am/oauth2/realms/alpha/access_token&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--data-urlencode &#39;grant_type=authorization_code&#39; \<br>--data-urlencode &#39;code=lL2WKHEd4Pl5Q11HomEC5XKGrBU&#39; \<br>--data-urlencode &#39;client_id=myClient&#39; \<br>--data-urlencode &#39;client_secret=password&#39; \<br>--data-urlencode &#39;redirect_uri=http://www.google.com&#39;</pre><p>My tokens are returned</p><pre>{<br>    &quot;access_token&quot;: &quot;&lt;token&gt;&quot;,<br>   ..<br>    &quot;expires_in&quot;: 59<br>}</pre><p>Let’s hit the introspect endpoint and check the results</p><pre>curl - location &#39;https://URL/am/oauth2/realms/alpha/introspect&#39; \<br> - header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br> - data-urlencode &#39;token=&lt;Token&gt;&#39; \<br> - data-urlencode &#39;client_id=myClient&#39; \<br> - data-urlencode &#39;client_secret=password&#39;</pre><p>The response :</p><pre>{<br>    &quot;active&quot;: true,<br>    &quot;scope&quot;: &quot;profile&quot;,<br>    &quot;realm&quot;: &quot;/alpha&quot;,<br>    &quot;client_id&quot;: &quot;myClient&quot;,<br>    &quot;user_id&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;username&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;token_type&quot;: &quot;Bearer&quot;,<br>    &quot;exp&quot;: 1707455073,<br>    &quot;sub&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;iss&quot;: &quot;https://URL:443/am/oauth2/alpha&quot;,<br>    &quot;subname&quot;: &quot;e825ba66-045b-419b-b1b9-56d625190027&quot;,<br>    &quot;auth_level&quot;: 0,<br>    &quot;authGrantId&quot;: &quot;NyiFowJN2Svw2_z__YnKyc6HdMA&quot;,<br>    &quot;auditTrackingId&quot;: &quot;cd24c749-c6cd-47fa-9d72-1e1891323c8d-2075790&quot;,<br>    &quot;expires_in&quot;: 45<br>}</pre><p>Notice that the “exp” time is set which affects the “expires_in” that’s correctly set to 45 (counting down).</p><p>You can keep hitting the introspect endpoint until you see that it expires :</p><pre>{<br>    &quot;active&quot;: false<br>}</pre><p>And that’s it, you have a script that dynamically sets the token expiry based on the Auth Level.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb14a9a49608" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing Success: Key Ingredients for a ForgeRock Identity Cloud Project]]></title>
            <link>https://marknienaber.medium.com/unleashing-success-key-ingredients-for-a-forgerock-identity-cloud-project-b1fc501b145d?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b1fc501b145d</guid>
            <category><![CDATA[forgerock-identity-cloud]]></category>
            <category><![CDATA[identity-management]]></category>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[access-management]]></category>
            <category><![CDATA[identity-and-access]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Wed, 31 May 2023 06:22:56 GMT</pubDate>
            <atom:updated>2023-05-31T06:22:56.275Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>In today’s digital landscape, organisations face a multitude of challenges when it comes to managing identities and ensuring secure access to their systems. <a href="https://www.forgerock.com/platform/identity-cloud">ForgeRock Identity Cloud</a> is a powerful solution that enables businesses to streamline their identity and access management (IAM) processes. However, the success of a ForgeRock Identity Cloud project depends on several critical factors. In this blog post, we will explore the key ingredients necessary for a successful ForgeRock Identity Cloud project.</p><h3>Roles and Responsibility</h3><p>Understanding the roles and responsibility of the ForgeRock Identity Cloud components, external applications and overall solution will allow an organisation to allocate resources during the project and help maintain the solution moving forward. Knowing where to find the right resources to assist will expedite issue resolution and allow for more efficient solution development.</p><h4>Platform Components</h4><p>ForgeRock Identity Cloud is a SaaS application deployed to Google Cloud Platform. The software components deployed inside the platform are managed by ForgeRock, while external software components that make up the overall solution but do not fit inside the platform are managed by the organisation.</p><p><strong>ForgeRock Components</strong></p><p>ForgeRock is responsible for deploying, managing, upgrading and monitoring the various software components as part of the platform. ForgeRock also regularly backs up data and provides <a href="https://backstage.forgerock.com/docs/idcloud/latest/product-information/high-availability-disaster-recovery.html">High Availability and Disaster Recovery</a>. Organisations no longer have to be concerned with spinning up complex architectures for various environments, as ForgeRock does this all for you. Each customer receives a development, staging and production environment to start and customers can request any number of sandbox environments to support development, see <a href="https://backstage.forgerock.com/docs/idcloud/latest/tenants/environments-development-staging-production.html">here</a> for more detail.</p><p>The following ForgeRock software and services are all wrapped up in a single ForgeRock Identity Cloud Platform:</p><ul><li>ForgeRock Access Management</li><li>ForgeRock Identity Management</li><li>ForgeRock Directory Services</li><li>Cloud DevOps — <a href="https://backstage.forgerock.com/docs/idcloud/latest/tenants/environments-development-staging-production.html#promoting_configuration">Promoting configuration</a></li><li>Admin UI’s / <a href="https://backstage.forgerock.com/docs/idcloud/latest/uis/identity-cloud-hosted-pages.html">Hosted Pages</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*C4XIGQAMu0OdwFxg" /><figcaption>ForgeRock Identity Cloud Components</figcaption></figure><p><strong>Organisation Components</strong></p><p>The organisation is responsible for deploying, managing, and upgrading the software/solution components deployed outside of ForgeRock Identity Cloud, but still acting as part of the overall solution. Of course, any ForgeRock products deployed onsite will still be covered by ForgeRock product support.</p><p>The organisation’s components may include:</p><ul><li>Custom UI’s backed by <a href="https://backstage.forgerock.com/docs/idcloud/latest/developer-docs/sdks.html">ForgeRock SDK</a></li><li><a href="https://backstage.forgerock.com/docs/idcloud/latest/identities/sync-identities.html">Remote Connector Servers</a></li><li>Edge Components like <a href="https://backstage.forgerock.com/docs/openig">ForgeRock Identity Gateway</a></li><li>The organisation’s own CI/CD Pipeline</li><li><a href="#4ffa">Overall solution monitoring</a></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/913/0*vDGpnBJRQ7rOet56" /><figcaption>Organisation Components</figcaption></figure><h4>Customer Solution</h4><p>During the project, a solution will be custom built by the deployment team to meet the organisation’s requirements. This solution is the product that the organisation owns and is delivering to it’s customers. Maintenance, monitoring and enhancements to this product are the responsibility of the organisation. ForgeRock maintains responsibility of the underlying software inside ForgeRock Identity Cloud and offers around the clock support for any issues that may arise with the software.</p><p>For organisations to support the product they are delivering to their customers, some may train or even hire internal technical resources, consult a partner organisation/SI, and may engage <a href="https://www.forgerock.com/support/deployment-support-services">ForgeRock technical consultants as required</a>.</p><h3>Technical Skills and Training</h3><p>ForgeRock provides comprehensive product training for all of it’s products, these can be access through <a href="https://backstage.forgerock.com/university/on-demand">ForgeRock University</a>. It is highly recommended that technical resources assigned to the ForgeRock Identity Cloud project have attended relevant courses. The courses can help enble resources prior to the project and on an ongoing basis as new technical resources are onboarded. Working with a trusted partner / SI can also help to reinforce the technical skills required. ForgeRock technical consultants will work along side your team/s and assist in the implementation.</p><h3>Clear Objectives and Requirements</h3><p>The foundation of any successful project lies in clearly defining its objectives and requirements. Start by identifying the pain points within your organisation’s current identity management infrastructure and determine the specific goals you aim to achieve with the ForgeRock Identity Cloud. These objectives could include enhancing user experience, strengthening security measures, or streamlining administrative tasks.</p><p>When moving your solution from an on premise or legacy system to ForgeRock Identity Cloud, we recommend you “Reimagine” your solution using this opportunity to retire technical debt i.e. what are the outcomes that need to be achieved, how will successful achievement of those outcomes be measured and how will those outcomes benefit your organisation and its customers. Building this into a well defined roadmap allows alignment between the project team and stakeholders around a shared vision. It is critical this vision is defined prior to the commencement of the project, coupled with a clearly defined MVP and key outcomes milestones with measurable success criteria.</p><blockquote>If you can’t define Success, you can’t succeed.</blockquote><h3>Comprehensive Planning and Strategy</h3><p>Once the project objectives are established, it’s essential to develop a comprehensive plan and strategy. Consider factors such as the scope of the project, the resources required, the timeline, and the potential risks involved. Collaborate closely with key stakeholders, including IT teams, security experts, and business leaders, to ensure that the project aligns with broader organisational goals and addresses specific user needs effectively. A project manager for the organisation sitting as part of the project team, and with clear boundaries and scope will ensure the project focusses on it’s MVP while meeting it’s broader long-term goals.</p><h3>Robust Architecture and Design</h3><p>The architecture and design of your ForgeRock Identity Cloud deployment are critical for its success. Work closely with experienced architects and developers to design a scalable, flexible, and secure solution that can accommodate your organisation’s current and future requirements. Consider factors such as user volumes, integration capabilities, compliance regulations, and the need for customisation. A well-thought-out architecture will help optimise performance, minimize downtime, and support future expansion. ForgeRock technical consultants will work with the organisation to ensure the solution architecture developed is sufficient for your needs and meets best-practices, and can then be incorporated into the organisation’s overall design.</p><h3>Seamless Integration and Data Migration</h3><p>A successful implementation of ForgeRock Identity Cloud relies on seamless integration with your existing systems. Ensure that your project team has a deep understanding of your organisation’s technology landscape to establish smooth integration points. A careful approach to data migration is also vital to ensure a seamless transition from legacy systems to the new solution. Data cleansing, mapping and validation processes should be executed meticulously to maintain data integrity and prevent any disruptions to user access or experience. Many organisations legacy systems retain inaccurate or even corrupt data, it’s critical that the migration to a cutting edge platform like ForeRock Identity Cloud is viewed as an opportunity to remove this technical debt. ForgeRock technical consultants can help the organisation understand what is necessary to meet requirements.</p><h3>Thorough Testing and Quality Assurance</h3><p>Testing and quality assurance are crucial stages of any project implementation. Conduct comprehensive testing to validate the functionality, security, and performance of your ForgeRock Identity Cloud deployment. Test different scenarios, such as user registration, authentication, authorisation, and password management, to ensure a seamless end-user experience. Invest in automated testing tools and techniques to increase efficiency and accuracy while minimising the risk of human error. Work with your ForgeRock customer deployment manager and ForgeRock technical consultants on planning your testing to ensure your solution is ready for your customers.</p><h3>User Adoption and Change Management</h3><p>Successful implementation of ForgeRock Identity Cloud is not just about the technical aspects; it also requires a focus on user adoption and change management. Plan and execute a robust change management strategy that includes clear communication, training programs, and ongoing support to ensure a smooth transition for end users. Address any concerns or resistance to change by highlighting the benefits of the new system and demonstrating its usability. This is particularly important as the move to FogeRock Identity Cloud offers :</p><ul><li>Modern standards-based integration patterns</li><li>Opportunities to provide dynamic yet secure authentication options</li><li>The ability to remove antiquated legacy functionality as you move into the future.</li></ul><h3>Continuous Monitoring and Optimization</h3><p>Once your ForgeRock Identity Cloud project is live, it’s crucial to have a process for continuous monitoring and optimisation.</p><p>Implement proactive monitoring tools to identify and address potential service disruptions and maximise customer satisfaction. For example, monitoring authentication may not provide a complete picture of the entire <strong><em>user</em></strong> experience. It may be important to include self service flows, authentication, authorisation, token generation etc. Monitoring the correct critical aspects of your solution will enable the business to proactively react.</p><p>Regularly review and optimise the solution based on user feedback, evolving business requirements, and industry best practices. Stay up to date with ForgeRock’s releases and updates to leverage new features and enhancements that can further improve your IAM processes. ForgeRock Support can be contacted around the clock to provide product support and ForgeRock technical consultants or one of ForgeRock’s experienced partners can be engaged to assist with the solution.</p><h3><strong>Conclusion</strong></h3><p>A successful ForgeRock Identity Cloud project requires a combination of careful planning, robust architecture, seamless integration, thorough testing, user-centric change management, and ongoing monitoring and optimisation. A clear understanding of the roles and responsibilities of the platform and solution will help with resource allocation and expedite issue resolution.</p><p>By investing time and effort into each of these key ingredients, organisations can unlock the full potential of ForgeRock’s powerful IAM solution, delivering enhanced security, improved user experience, and streamlined identity management processes.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b1fc501b145d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Custom OIDC claims in ForgeRock Identity Cloud]]></title>
            <link>https://marknienaber.medium.com/custom-oidc-claims-in-forgerock-identity-cloud-6873191ad3e9?source=rss-ee99e09cb4f8------2</link>
            <guid isPermaLink="false">https://medium.com/p/6873191ad3e9</guid>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[oauth]]></category>
            <category><![CDATA[forgerock-identity-cloud]]></category>
            <category><![CDATA[openid]]></category>
            <dc:creator><![CDATA[Mark Nienaber]]></dc:creator>
            <pubDate>Fri, 19 May 2023 03:48:17 GMT</pubDate>
            <atom:updated>2023-05-19T03:59:53.480Z</atom:updated>
            <content:encoded><![CDATA[<p><em>A guide to adding additional OIDC claims from the identity schema in ForgeRock Identity Cloud</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/726/0*oT-S1R3Mv2auZvZn" /></figure><p>Clients or Relying Parties consuming OpenID Connect (OIDC) tokens may require additional attributes inside the OIDC Token (id_token).</p><p>We are going to address two common use cases where we retrieve values of different attributes from the authenticated user to include in the token.</p><p>The ForgeRock identity cloud user schema provides :</p><ul><li><em>Standard</em> user attributes like first name, last name etc</li><li><em>General purpose extension attributes</em>, some indexed, some not, these are baked into the schema and have set names like Generic Indexed String 1 or Generic Unindexed Multivalue 3.</li><li><em>Custom unindexed attributes</em> which can be added to the schema, with names like custom_myAttribute.</li></ul><p>More information about the Identity Schema can be found <a href="https://backstage.forgerock.com/docs/idcloud/latest/identities/identity-cloud-identity-schema.html">here</a>. Also each of the attribute is referenced differently in IDM vs AM, the reference table for this is found <a href="https://backstage.forgerock.com/docs/idcloud/latest/identities/user-identity-properties-attributes-reference.html#reference_tables">here</a>.</p><p>Referencing standard and general purpose extension attributes relatively simple as they are explicitly defined in the schema. Custom attributes are a little more complex as they are stored in a single JSON blob. The two use cases below will address each of these.</p><blockquote><strong>Use Case 1 — Requirements</strong></blockquote><blockquote>The ID Token must include a claim called “status” and the value must be the value of the general purpose extension attribute — Generic Indexed String 1.</blockquote><blockquote><strong>Use Case 2 — Requirements</strong></blockquote><blockquote>The ID Token must include a claim called “preferredMail” and the value must be the value of a custom attribute called custom_preferredMail.</blockquote><h3>OIDC Claims Script</h3><p>ForgeRock provides a mechanism to customise the ID Token by use of an OIDC Claims Script. The OIDC claims script is run when the ID Token is minted by the OpenID Provider (OP), a role filled by ForgeRock Access Management.</p><h4>OpenID Provider</h4><p>The script used by the provider can be viewed or changed by looking at the OAuth2 Provider service in the AM. To do this browse to the Access Manager Native Console, then go to <strong>Services</strong>, <strong>OAuth2 Provider</strong>, then the <strong>Plugins</strong> tab. The <strong>OIDC Claims script</strong> will be listed there, and the <strong>OIDC Claims Plugin type</strong> says to use this Script as it’s noted as <strong>SCRIPTED</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-cM8H7C-De4-N3e9GAFYaA.jpeg" /></figure><p>It’s possible to create your own script and set it at the provider level, this will be it’s called any time the provider is called to mint an id_token.</p><blockquote><strong>Important</strong>: customisations made to the Provider level affects ALL clients.</blockquote><h4>OIDC Client</h4><p>The OIDC Claims script can be overridden at the client level, for example Application 1 requires certain additional claims, while Application 2 needs the basic OOTB claims.</p><p>For both our use cases we are setting at the client level so let’s setup a new client and custom claims script.</p><p><strong>Create Application</strong></p><p>Browse to <strong>Applications</strong> and <strong>+ Custom Application.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/905/1*oSFuKR9CC_1AKaT8jpt59g.jpeg" /></figure><p>Create an application of type <strong>OIDC</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/795/1*BaqaYDylKhkxlFgtR-V2aw.jpeg" /></figure><p>Select <strong>Web</strong> application type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*Kfl41aw_vi0bCVT3Olxrtw.jpeg" /></figure><p>We will call our client <strong>NewClient</strong>, you’ll also be required to set an owner then press <strong>Next</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/791/1*ohv1zyzL7MVnUSXbOuBerw.jpeg" /></figure><p>Once Created, browse to the AM Native Console then go to <strong>Applications</strong>, <strong>OAuth 2.0</strong>, <strong>Clients</strong> and click on the <strong>NewClient</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6PjZDSjEW-XWr0ff6puwtA.jpeg" /></figure><p>Modify the new client and add in :</p><ul><li>Redirection URI: <a href="http://www.google.com/">http://www.google.com</a></li><li>Scopes: status customMail</li></ul><p>Press <strong>Save</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ud7RhwtopQC3FCuRvSs94Q.jpeg" /></figure><p>On the <strong>Advanced</strong> tab, set the <strong>Token Endpoint Authentication Method</strong> to <strong>client_secret_post</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*X5VhjXHab8KzRmn0h8mlkA.jpeg" /></figure><p>To make sure this is working lets get an id_token with a standard set of scopes i.e. openid, profile and email.</p><p>Expectation:</p><ol><li><strong>openid</strong> scope will request an id_token</li><li><strong>profile</strong> scope will return a set of claims representing basic profile attributes i.e. name, family_name, given_name etc</li><li><strong>email</strong> is a separate claim mapped to the mail attribute</li></ol><p>Make a REST call to the authorize endpoint:</p><pre>curl - location &#39;https://openam-fidc.forgeblocks.com/am/oauth2/realms/alpha/authorize?client_id=NewClient&amp;redirect_uri=http%3A%2F%2Fwww.google.com&amp;state=abc123&amp;response_type=code&amp;scope=email%20profile%20openid&#39; \<br> - header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br> - header &#39;Cookie: &lt;session_cookie&gt;=&lt;SSO Token&gt;&#39;</pre><p>The response includes the code in the 302 redirect which we swap for the token</p><pre>curl - location &#39;https://openam-fidc.forgeblocks.com/am/oauth2/realms/alpha/access_token&#39; \<br> - header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br> - data-urlencode &#39;grant_type=authorization_code&#39; \<br> - data-urlencode &#39;code=SAQockGPRFrD5XhF1v_1jAi4qe4&#39; \<br> - data-urlencode &#39;client_id=NewClient&#39; \<br> - data-urlencode &#39;client_secret=password&#39; \<br> - data-urlencode &#39;redirect_uri=http://www.google.com&#39;</pre><p>We have our tokens in the response including the id_token, when decoded:</p><pre>{<br> &quot;iss&quot;: &quot;https://openam-fidc.forgeblocks.com:443/am/oauth2/alpha&quot;,<br> &quot;tokenName&quot;: &quot;id_token&quot;,<br> &quot;given_name&quot;: &quot;Mark&quot;,<br> &quot;azp&quot;: &quot;NewClient&quot;,<br> &quot;name&quot;: &quot;Mark Nienaber&quot;,<br> &quot;family_name&quot;: &quot;Nienaber&quot;,<br> &quot;email&quot;: &quot;mailattribute@email.com&quot;,<br>... additional standard token claims<br>}</pre><p>Let’s customise the OIDC claims script to provide some additional information.</p><p><strong>Create Custom OID Script</strong></p><p>Browse to <strong>Scripts</strong>, <strong>Auth Scripts</strong>, <strong>New Script</strong> then of type <strong>OIDC Claims</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3JiSXtZ5TNJvqkdCPxIKLQ.jpeg" /></figure><p>Let’s call this NewClientOIDClaimScript</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/580/1*saxxe7L9oNK5eeqAe0NoSg.jpeg" /></figure><p><strong>Set Client Overrides</strong></p><p>In the OAuth Client we will override the provider settings and set the client specific OID Claims script we created above.</p><p>In the AM Native Console, browse to <strong>Applications</strong>, <strong>OAuth 2.0</strong>, <strong>Clients</strong>, and select the new client — <strong>NewClient</strong>.</p><p>Browse to the <strong>OAuth2 Provider Overrides</strong> tab.</p><p>Check the <strong>Enable OAuth2 Provider Overrides</strong> checkbox to enable overrides, now the client will use the settings on this page.</p><blockquote><strong>Important</strong>: Ensure all the relevant options for this client are selected on this page i.e. <strong>Allow Clients to Skip Consent</strong>, <strong>Use Client-Side Access &amp; Refresh Tokens</strong> etc</blockquote><p>Set <strong>OIDC Claims Plugin Type</strong> is set to <strong>SCRIPTED</strong>, set the <strong>OIDC Claims Script</strong> to be the new script, <strong>NewClientOIDClaimScript</strong> then press Save.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDXf2PWKL-FftiHHG2BRzg.jpeg" /></figure><p>We have now set up our client, so let’s look at the use cases and customise the script.</p><p>To see the sample script, browse <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/miscellaneous/browse/NewClientOIDClaimScript.js">here</a>.</p><h3><strong>Use Case 1 — include status</strong></h3><h4>Modify setScopeClaimsMap</h4><p>Modify the NewClientOIDClaimScript and add in a status claim to the setScopeClaimsMap.</p><p>This says there is a claim called status, and the value will come from the ‘status’ resolver.</p><pre> utils.setScopeClaimsMap({<br>        profile: [<br>            &#39;name&#39;,<br>            &#39;family_name&#39;,<br>            &#39;given_name&#39;,<br>            &#39;zoneinfo&#39;,<br>            &#39;locale&#39;<br>        ],<br>        email: [&#39;email&#39;],<br>        address: [&#39;address&#39;],<br>        phone: [&#39;phone_number&#39;],<br>      status:[&#39;status&#39;] // &lt;-- new claim<br>    });</pre><h4>Add Claim Resolver</h4><p>Add the claim resolver for ‘status’ and use the already existing getUserProfileClaimResolver to get the available attribute fr-attr-istr1.</p><pre>utils.setClaimResolvers({<br>  <br>  name: utils.getUserProfileClaimResolver(&#39;cn&#39;),<br>  family_name: utils.getUserProfileClaimResolver(&#39;sn&#39;),<br>  given_name: utils.getUserProfileClaimResolver(&#39;givenname&#39;),<br>  zoneinfo: utils.getUserProfileClaimResolver(&#39;preferredtimezone&#39;),<br>  locale: utils.getUserProfileClaimResolver(&#39;preferredlocale&#39;),<br>  status: utils.getUserProfileClaimResolver(&#39;fr-attr-istr1&#39;), // &lt;-- new claimResolver<br> email: utils.getUserProfileClaimResolver(&#39;mail&#39;),</pre><h4>Test</h4><p>If we look at a test user in Identity Cloud we can see the the value for frIndexedString1 = Enabled. Remember that frIndexedString1 is the IDM attribute for fr-addr-istr1.</p><pre>{<br>  &quot;custom_initials&quot;: &quot;mn&quot;,<br>  &quot;custom_otherGivenNames&quot;: &quot;smithy&quot;,<br>  &quot;country&quot;: null,<br>  &quot;frUnindexedString1&quot;: null,<br>  &quot;frIndexedString1&quot;: &quot;Enabled&quot;, // &lt;--- we want this value in the token<br>  &quot;givenName&quot;: &quot;Mark&quot;,<br>  &quot;accountStatus&quot;: &quot;Active&quot;,<br>  &quot;sn&quot;: &quot;Nienaber&quot;<br>}</pre><p>Request token with additional <strong>status</strong> scope</p><pre>curl --location &#39;https://openam-fidc.forgeblocks.com/am/oauth2/realms/alpha/authorize?response_type=code&amp;client_id=NewClient&amp;redirect_uri=http%3A%2F%2Fwww.google.com&amp;state=abc123&amp;scope=email%20profile%20openid%20status&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--header &#39;Cookie: &lt;cookieName&gt;=&lt;SSO Token&gt;&#39;</pre><p>After swapping the code for a token, we get the id_token, which when decoded contains a new claim named <strong>status</strong> and the value is <strong>Enabled</strong> as expected.</p><pre>{<br>  &quot;tokenName&quot;: &quot;id_token&quot;,<br>  &quot;given_name&quot;: &quot;Mark&quot;,<br>  &quot;aud&quot;: &quot;NewClient&quot;,<br>  &quot;acr&quot;: &quot;0&quot;,<br>  &quot;name&quot;: &quot;Mark Nienaber&quot;,<br>  &quot;realm&quot;: &quot;/alpha&quot;,<br>  &quot;tokenType&quot;: &quot;JWTToken&quot;,<br>  &quot;family_name&quot;: &quot;Nienaber&quot;,<br>  &quot;email&quot;: &quot;mailattribute@email.com&quot;,<br>  &quot;status&quot;: &quot;Enabled&quot;, // &lt;--- new value included<br>...... additional claims<br>}</pre><h3>Use Case 2 — include custom attribute</h3><p>This use case is a little more involved because custom attributes like custom_preferredMail are stored in a JSON blob named fr-idm-custom-attrs. We will create a custom claim resolver to get this value.</p><h4>Modify setScopeClaimsMap</h4><p>Modify the <strong>NewClientOIDClaimScript</strong> and add in a customMail claim to the setScopeClaimsMap.</p><pre>utils.setScopeClaimsMap({<br>    profile: [<br>        &#39;name&#39;,<br>        &#39;family_name&#39;,<br>        &#39;given_name&#39;,<br>        &#39;zoneinfo&#39;,<br>        &#39;locale&#39;<br>    ],<br>    email: [&#39;email&#39;],<br>    address: [&#39;address&#39;],<br>    phone: [&#39;phone_number&#39;],<br>    status:[&#39;status&#39;],<br>  customMail:[&#39;customMail&#39;] // &lt;--- new claim<br><br>});</pre><h4>Modify claimResolvers</h4><p>Update setClaimResolvers to include customMail, and for that resolver to use getCustomClaimResolver which we will create below.</p><pre>utils.setClaimResolvers({<br>  name: utils.getUserProfileClaimResolver(&#39;cn&#39;),<br>  family_name: utils.getUserProfileClaimResolver(&#39;sn&#39;),<br>  given_name: utils.getUserProfileClaimResolver(&#39;givenname&#39;),<br>  zoneinfo: utils.getUserProfileClaimResolver(&#39;preferredtimezone&#39;),<br>  locale: utils.getUserProfileClaimResolver(&#39;preferredlocale&#39;),<br>  status: utils.getUserProfileClaimResolver(&#39;fr-attr-istr1&#39;),<br>  email: utils.getUserProfileClaimResolver(&#39;mail&#39;),<br> customMail: utils.getCustomClaimResolver( // &lt;--- new resolver<br>      /**<br>       * Pass in the full JSON blob of all custom attributes<br>       */<br>      utils.getUserProfileClaimResolver(&#39;fr-idm-custom-attrs&#39;)<br>  ),</pre><h4>Create custom claim resolver</h4><p>We will create a new custom claim resolver named getCustomClaimResolver. This will take the full fr-idm-custom-attrs JSON string and parse the value to return a specific value. The value in this case is a string, but this could be any supported type.</p><pre>// new custom claim resolver<br>function getCustomClaimResolver(resolveClaim) {<br>    function resolveCustomClaim(claim) {<br>        var claimValue = resolveClaim(claim);<br>        var customClaim;<br>        var customEmailAttr = &quot;custom_preferredMail&quot;;<br>        if (isClaimValueValid(claimValue)) {<br>            customClaim = JSON.parse(claimValue);<br>            return customClaim[customEmailAttr];<br>        }<br>    }<br>    return resolveCustomClaim;<br>}</pre><h4>Make method public</h4><p>Add the new claim resolver to the list of public methods so it can be called above.</p><pre>        // PUBLIC METHODS<br><br>return {<br>  setScopeClaimsMap: setScopeClaimsMap,<br>  setClaimResolvers: setClaimResolvers,<br>  getUserProfileClaimResolver: getUserProfileClaimResolver,<br>  getAddressClaimResolver: getAddressClaimResolver,<br>  getEssentialClaimResolver: getEssentialClaimResolver,<br>  getUserInfoClaims: getUserInfoClaims,<br>  getCustomClaimResolver: getCustomClaimResolver // &lt;-- custom resolver<br>};</pre><h4>Test</h4><p>Looking at the the JSON of the user in question, we note the value for custom_preferredMail.</p><pre>{<br>  &quot;custom_initials&quot;: &quot;mn&quot;,<br>  &quot;custom_otherGivenNames&quot;: &quot;smithy&quot;,<br>  &quot;country&quot;: null,<br>  &quot;frUnindexedString1&quot;: null,<br>  &quot;frIndexedString1&quot;: &quot;Enabled&quot;,<br>  &quot;givenName&quot;: &quot;Mark&quot;,<br>  &quot;accountStatus&quot;: &quot;Active&quot;,<br>  &quot;sn&quot;: &quot;Nienaber&quot;,<br>  &quot;custom_preferredMail&quot;: &quot;mypreferredMail@mail.com&quot;,<br>}</pre><p>Lets request a token and include the customMail scope.</p><pre>curl --location &#39;https://openam-fidc.forgeblocks.com/am/oauth2/realms/alpha/authorize?response_type=code&amp;client_id=NewClient&amp;redirect_uri=http%3A%2F%2Fwww.google.com&amp;state=abc123&amp;scope=email%20profile%20openid%20status%20customMail&#39; \<br>--header &#39;Content-Type: application/x-www-form-urlencoded&#39; \<br>--header &#39;Cookie: &lt;cookieName&gt;=&lt;SSO Token&gt;&#39;</pre><p>After swapping the code for a token, we receive the id_token with the correct value.</p><pre>{<br>  &quot;tokenName&quot;: &quot;id_token&quot;,<br>  &quot;email&quot;: &quot;mailattribute@email.com&quot;,<br>  &quot;subname&quot;: &quot;174a4f9c-b6b1-4d18-a1c4-c5597e987979&quot;,<br>  &quot;given_name&quot;: &quot;Mark&quot;,<br>  &quot;aud&quot;: &quot;NewClient&quot;,<br>  &quot;name&quot;: &quot;Mark Nienaber&quot;,<br>  &quot;realm&quot;: &quot;/alpha&quot;,<br>  &quot;tokenType&quot;: &quot;JWTToken&quot;,<br>  &quot;family_name&quot;: &quot;Nienaber&quot;,<br>  &quot;customMail&quot;: &quot;mypreferredMail@mail.com&quot;, &lt;---New Claim added<br>  &quot;status&quot;: &quot;Enabled&quot;<br>}</pre><p>The sample script used in this article can be found <a href="https://stash.forgerock.org/users/mark.nienaber_forgerock.com/repos/miscellaneous/browse/NewClientOIDClaimScript.js">here</a>.</p><p>And that’s it folks.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6873191ad3e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>