<?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 Steffo Weber on Medium]]></title>
        <description><![CDATA[Stories by Steffo Weber on Medium]]></description>
        <link>https://medium.com/@steffoweber?source=rss-913bac626aba------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*5mXVB6Ng_OFI6fsW.png</url>
            <title>Stories by Steffo Weber on Medium</title>
            <link>https://medium.com/@steffoweber?source=rss-913bac626aba------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 03:15:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@steffoweber/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[OpenAM. Remote OAuth2 Consent Service]]></title>
            <link>https://medium.com/@steffoweber/openam-remote-oauth2-consent-service-944a4e261d1c?source=rss-913bac626aba------2</link>
            <guid isPermaLink="false">https://medium.com/p/944a4e261d1c</guid>
            <category><![CDATA[psd2]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[openai]]></category>
            <dc:creator><![CDATA[Steffo Weber]]></dc:creator>
            <pubDate>Fri, 07 Sep 2018 12:54:08 GMT</pubDate>
            <atom:updated>2018-09-07T12:54:08.775Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Throughout this article we use OpenAM as a synonym for ForgeRock Access Manager. At the time of writing — September 2018 — AM 6.0.0.4 was the current version. Please see ForgeRock website for differences between AM and the OpenAM-project.</em></p><p>OpenAM can collect the user consent in an OAuth2 flow via its built in consent collector or can call an external collector. Advantage of external collector is</p><ul><li>fully customizable UI (you write yr own app using whatever UI framework you like</li><li>fully customizable reponse (you might want to have a consent decision like “accept”, “deny” and maybe “cancel” — to cancel the whole flow)</li><li>fully customizable consent (eg if you have a paramterized scope as in PSD2 payment transaction, you don’t want to present the scope as “Do you consent to pay for transaction txID 123?” but rather want to resolve the txID via an external service so that the consent screen contain “Do you want Musicstore Inc to withdraw 965 € for certain guitar <em>Fender Telecaster Nashville</em>?”</li></ul><p>When AM asks RCS for consent, it sends a signed (optionally encrypted) JWT to RCS. RCS replies by letting user-agent POST a signed JWT to AM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*juJPOXdAbGZy_jQ6etLz2A.png" /><figcaption>Consent from RCS is gather via signed (optionally enrypted) JWTs</figcaption></figure><h3>Configuring OpenAM</h3><p>Following the documentation in the <a href="https://backstage.forgerock.com/docs/am/6/oauth2-guide">OAuth2 guide</a> you need to</p><ul><li><a href="https://backstage.forgerock.com/docs/am/6/oauth2-guide/#oauth2-implement-remote-consent">enable remote consent usage</a></li><li><a href="https://backstage.forgerock.com/docs/am/6/oauth2-guide/#configure-oauth2-rcs-client">create an RCS agent configuration</a> (to tell AM where to find the agent, what crypto keys to use etc)</li></ul><p>Here are my settings for OAuth2 service and RCS agent.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*tZoI0bX_I2A0sgxEUZjjaQ.png" /><figcaption>OAuth2 Authorization Service settings with enabled RCS.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/735/1*Op-URGJxVreSxNELNG0PyQ.png" /><figcaption>Settings for RCS agent. Redirect URL and JWK URI are to be set.</figcaption></figure><h3>A NodeJS RCS service</h3><p>RCS needs three things</p><ol><li>URL from where AM can get the keys (JWK).</li><li>Endpoint for AM to redirect user to.</li><li>Method to collect scope user consented for. In this example the user will FORM POST the granted scope (“uid”, “mail” whatever) and RCS will then create the JWT.</li></ol><p>A sample service (not for production) can be found here: <a href="https://github.com/steffow/RCS">https://github.com/steffow/RCS</a> . This service has been designed to have only bare minimum of UI so that you can add your favourite framework.</p><p>Let’s have a look on how the RCS flow with the above NodeJS service looks like. We assume you created an OAuth2 client called test on AM. If a user wants to use a certain application, that application will redirect him via sth like</p><pre>id.init8.net:8080/openam/oauth2/authorize?client_id=test&amp;response_type=code&amp;redirect_uri=<a href="http://localhost:3001/redirect&amp;scope=uid&amp;state=1234zy">http://localhost:3001/redirect&amp;scope=uid%20mail%20telephoneNumber&amp;state=1234zy</a></pre><p>After successful login (with standard AM try “demo/changeit”) AM will redirect the user to the remote consent service (NodeJS). The RCS will display the required scope: uid mail telephoneNumber:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*f1GgpJ8u78knjAqGA_tEoQ.png" /><figcaption>Sample consent page (left as ugly as possible, so that you can put lipstick on)</figcaption></figure><p>When user click Sign that form will be posted to RCS app where the consented scope will be added to the JWT and signed. Note that uid has not been consented to and there is not part of the scope.</p><pre>{<br>  &quot;clientId&quot;: &quot;test&quot;,<br>  &quot;iss&quot;: &quot;rcs&quot;,<br>  &quot;csrf&quot;: &quot;8+oLdL1CIuRO3pXXCrWWGRR3hFCzhgpZaukufpnBhD4=&quot;,<br>  &quot;client_description&quot;: &quot;&quot;,<br>  &quot;aud&quot;: &quot;<a href="http://id.init8.net:8080/openam/oauth2">http://id.init8.net:8080/openam/oauth2</a>&quot;,<br>  &quot;save_consent_enabled&quot;: false,<br>  &quot;claims&quot;: {},<br>  &quot;scopes&quot;: [<br>    &quot;telephoneNumber&quot;,<br>    &quot;mail&quot;<br>  ],<br>  &quot;exp&quot;: 1536323245,<br>  &quot;iat&quot;: 1536323065,<br>  &quot;client_name&quot;: &quot;test&quot;,<br>  &quot;consentApprovalRedirectUri&quot;: &quot;<a href="http://id.init8.net:8080/openam/oauth2/authorize?client_id=test&amp;response_type=code&amp;redirect_uri=http://localhost:3001/redirect&amp;scope=uid%20mail%20telephoneNumber&amp;state=1234zy">http://id.init8.net:8080/openam/oauth2/authorize?client_id=test&amp;response_type=code&amp;redirect_uri=http://localhost:3001/redirect&amp;scope=uid%20mail%20telephoneNumber&amp;state=1234zy</a>&quot;,<br>  &quot;username&quot;: &quot;demo&quot;,<br>  &quot;decision&quot;: true<br>}</pre><p>The user-agent (browser) needs to post the signed JWT to AM’s consentApprovalRedirectUri (that paramter-name has probably been invented by a German engineer). In out sample app, we will present a FORM with hidden field:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/410/1*mJIa7vNRysCPAkOM4SebpA.png" /><figcaption>If you click on Submit Consent, the signed JWT will be posted to AM</figcaption></figure><p>AM replies with</p><pre><a href="http://localhost:3001/redirect?code=03UQ86YUGTjFvoK3B_a0IgJX1uA&amp;scope=telephoneNumber%20m">http://localhost:3001/redirect?code=</a><strong>8hGJGaU1leCVG4fFqxgDoxNrNGg</strong><a href="http://localhost:3001/redirect?code=03UQ86YUGTjFvoK3B_a0IgJX1uA&amp;scope=telephoneNumber%20m">&amp;scope=telephoneNumber%20m</a></pre><p>which can be traded for an access_token:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y1JcwGrTGBLXHgDtiLTpDQ.png" /></figure><p>That’s it.</p><h3><strong>Need your support</strong></h3><p>Whenever you have a cunning RCS with an über-user-interface, send stuff to ForgeRock marketplace at <a href="https://backstage.forgerock.com/marketplace/catalogDisplay">https://backstage.forgerock.com/marketplace/catalogDisplay</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=944a4e261d1c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using regex-defined scopes with OpenAM]]></title>
            <link>https://medium.com/@steffoweber/using-regex-defined-scopes-with-openam-1818639ffb3f?source=rss-913bac626aba------2</link>
            <guid isPermaLink="false">https://medium.com/p/1818639ffb3f</guid>
            <category><![CDATA[berlin-group]]></category>
            <category><![CDATA[nextgenpsd2]]></category>
            <category><![CDATA[openam]]></category>
            <category><![CDATA[psd2]]></category>
            <category><![CDATA[forgerock]]></category>
            <dc:creator><![CDATA[Steffo Weber]]></dc:creator>
            <pubDate>Mon, 03 Sep 2018 07:59:47 GMT</pubDate>
            <atom:updated>2018-09-03T07:59:47.037Z</atom:updated>
            <content:encoded><![CDATA[<p>In many shopping scenarios — especially in PSDII world — ones need to express consent in form “I consent to let Amazon withdraw amount X from (from my bank account) in order to purchase product Y”. While this perfectly aligns with the ideas of OAuth2 protocol, there some pitfalls.</p><p>Most OAuth2 implementations use a static list of fixed scopes to express something like</p><p><em>Do you consent to give &lt;OAuth2Client&gt; READ access (to some resource)?</em></p><p>Here <em>READ</em> is a scope (that can be <em>mail</em>, <em>twitter-feed</em> etc in other implementations). With OAuth2’s growing popularity and adoption in frameworks like <strong>OpenBanking</strong> or BerlinGroup’s <strong>NextGen PSD2</strong> this fixed list of scopes needs to be enhanced to express consent/authorization decisions of the form</p><p><em>I consent, that &lt;OAuth2Client&gt; can withdraw 965 EUR from my bank account in order to pay for guitar G (or any other product you would like to purchase).</em></p><p>Here scopes have the form (in OpenBanking and NextGenPSDII word, the part behind the : is the <strong>PaymentID</strong> which is a reference to the purchase; also note that OpenBanking uses OIDC RequestParamter to express this consent).</p><p><strong>WITHDRAW:965#Guitar</strong></p><p>The only fixed thing here is the WITHDRAW action. Everything after the “:” is variable and depends on what you purchase. There’s nothing in the OAuth2 specs that would restrict the set of possible scopes an OAuth2 client can ask for to be defined by a regular expression. Actually in my discussion w OAuth2 experts, everybody seems to have different hidden assumptions on on the definition of scopes. Are they finite? Are they defined with help of non-terminating characters? Does the AS (authorization server) need to parse them? Long story short: we want to have variable scopes (sometimes called dynamic scopes).</p><h3>OpenAM implementation</h3><p>OpenAM assumes a fixed list of scopes that are available for each OAuth2 client, where each scope consists terminating characters only. The OpenAMScopeValidator class efficiently checks, if a client only asks for scopes, he’s allowed to ask for.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E7oYTan1j2ER6AX8vmyevQ.png" /><figcaption><strong><em>OpenAM OOTB Scope Implementation Class</em></strong></figcaption></figure><p>In order to allow for scopes defined by regular expression like <strong>^WITHDRAW:.</strong> which matches our example above, you just need to amend the OOTB implementation to do a bit of pattern matching:</p><pre>@Override</pre><pre>public Set&lt;String&gt; validateAccessTokenScope(ClientRegistration clientRegistration, Set&lt;String&gt; scope,</pre><pre>OAuth2Request request) {</pre><pre>List&lt;String&gt; requestedScopes = new ArrayList(scope);List&lt;String&gt; authorizedScopes = new ArrayList();List&lt;String&gt; allowedScopes = new ArrayList(clientRegistration.getAllowedScopes());</pre><pre>if (scope == null || scope.isEmpty()) {<br>   return clientRegistration.getDefaultScopes();<br>}</pre><pre>Iterator it = allowedScopes.iterator();<br>while (it.hasNext()) {        authorizedScopes.addAll(<strong>filter</strong>(requestedScopes, (String)it.next()));</pre><pre>   }<br>   return new HashSet&lt;&gt;(authorizedScopes);<br>}</pre><p>The magic is in filter method.</p><pre>private List&lt;String&gt; filter(List&lt;String&gt; reqestedScopes, String regex) {</pre><pre>   Pattern pattern = Pattern.compile(regex); //move outside method in production<br>   List&lt;String&gt; matching = reqestedScopes.stream().filter(pattern.asPredicate()).collect(Collectors.toList());<br>   return matching;<br>}</pre><p>Simply put that piece of code in your custom scope validator class (you’ll find sample code including Maven build files in OpenAM Samples directory).</p><p>After that, change the scope validator class to your new class.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*6qqAn07eQWme2I0cyI6XWA.png" /><figcaption><strong>Configure OAuth2 Provider to use custom class.</strong></figcaption></figure><p>Now you can configure your OAuth2 agents to use regex defined scopes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31-wH5BVKTq5nYvJNu-T5w.png" /></figure><p>Let’s give it a try with Postman.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/942/1*9sGOu56cUPc3ledP7jIaog.png" /></figure><p>And verify the opaque token at <strong>tokeninfo</strong> endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*g8H4Qs2vJemzCZA6w9MnsA.png" /></figure><p>We get all the scopes that are permitted for this client (including the ones that start with letter a).</p><h3>Summary</h3><p>OpenAM can be easily modified to cater the scope implementation that’s best for your use case. Note that different implementations can have different impact on performance etc. Thus, if you only have a classic list of fixed values, stick with the OOTB implementation. However, if you need to cater variable scopes (defined by regular exporessions) use your custom class.</p><p>This allows OpenAM to be used in scenarios like <a href="https://docs.wixstatic.com/ugd/c2914b_c0d9ed25f257401fa0122f5125603814.pdf">NextGenPSDII</a> (defined by Berlin Group) and many other modern OAuth2 use cases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1818639ffb3f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ForgeRock Access Manager on OpenShift (Part 1).]]></title>
            <link>https://medium.com/@steffoweber/forgerock-access-manager-on-openshift-part-1-5711fe0b92b5?source=rss-913bac626aba------2</link>
            <guid isPermaLink="false">https://medium.com/p/5711fe0b92b5</guid>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[openshift]]></category>
            <category><![CDATA[openam]]></category>
            <category><![CDATA[identity]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Steffo Weber]]></dc:creator>
            <pubDate>Fri, 16 Feb 2018 11:47:41 GMT</pubDate>
            <atom:updated>2018-02-16T15:19:01.445Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the first of two articles on how to deploy Access Manager, OpenAM, on OpenShift Online. We’ll focus on using the browser based console here, while the second article uses manifests and the “oc” CLI tool (which is much faster and better automates things).</p><p>Let’s assume that you’ve never accessed OpenShift before. We will use a Docker container to create an OpenShift application. The main steps are:</p><ol><li>Create a Docker image</li><li>Creating an OpenShift application by deploying this image.</li></ol><h3>OpenAM Docker image</h3><p>To create an AM Docker image, you need a Dockerfile. Simply pull everything from GitHub (<a href="https://github.com/steffow/openam-docker">https://github.com/steffow/openam-docker</a>). You also need to download OpenAM WAR file.</p><p>Try to BUILD and RUN image as per Readme.</p><p>Now commit/tag/push the image. If you do not know how to do this, look here: <a href="http://karlcode.owtelse.com/blog/2017/01/25/push-a-docker-image-to-personal-repository/">http://karlcode.owtelse.com/blog/2017/01/25/push-a-docker-image-to-personal-repository/</a></p><h3>OpenShift Deyployment</h3><p>You might need an OpenShift Online account. This procedure has been tested using a non-free plan. You should be able to run this with 2GiB (RAM and Disk). We used 4GiB RAM and 4GiB Disk. So have yr CreditCard next to you.</p><p>After you’ve logged, create a project in the OpenShift administration console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/478/1*rU1i5g7JdCMhK07doGreZQ.png" /></figure><p>Next you need to deploy the Docker image created in above. Pls note that due to licensing there is no ready-made AM container available, so you need to download the WAR and create the container using the above mentioned Dockerfiles.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/320/1*QjMioV5e91l1n8SKO4TtTQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*Zf6Z6ONCbTVXQvl-Jo6Hrg.png" /></figure><p>Enter the image name (here: steffow/am-eval which refers to <a href="https://hub.docker.com/r/steffow/am-eval/">https://hub.docker.com/r/steffow/am-eval/</a>). Click on the magnifying glass and OpenShift will prefill Name*. Click on Deploy. If all goes well, you’ll see “am-eval image has been created”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*wwXDc0Ux2MM39so8rGh7eg.png" /></figure><p>OpenShift will now automtically start to create a pod (which most likely crashes as we haven’t assigned additional memory yet). You might notice something like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*7H_r3XskQ9-GjYKTrDfPxA.png" /></figure><p>Now, increase memory by navigating to Deployments &gt; am-eval. First, you have to pause rollouts (the beauty of the CLI manifest version in Part 2 of the article is that you simply deploy everything in one step via “oc” command).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*FKDkhJqFhPvHpQzsYRH2sw.png" /></figure><p>Now that the rollout is paused, you can edit the resource limits:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*tX_Hptae4CQ8gx_xl3nlEg.png" /></figure><p>Use 2GiB Memory by editing the two fields REQUEST and LIMIT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*DvgQk42WvuflqqOvX_CA1g.png" /></figure><p>Sometimes the console needs a refresh. If you see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*OFHYQtXNm8X0_wSaWFawPA.png" /></figure><p>simply refresh (by clicking Shift Reload in your browser) and try “Edit Resource Limits” again.</p><p>Now RESUME rollouts. And you can now see via Applications &gt; Pods &gt; (select a pod) that the pod is running (you could also check for errors here)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/523/1*WqyCe4E7phqu_Y82DsNrjA.png" /></figure><p>Next step is to make your/application pod accessible from the outside world. For this you have to create a route. The easiest way to do this (apart from CLI) is to click into Services.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/293/1*SngCRR4K4aRQeG6ym-93uw.png" /></figure><p>OpenShift has created a service called “am-eval” for you. Select it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/631/1*NluOHG_GQ5a0yP_sP9RC3g.png" /></figure><p>and click “Create route”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*DTFgVYbgWS1Pd8y5Z3FBcA.png" /></figure><p>Now enter the pathname under which OpenAM is deployed. You’ll see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*iAZ4vS0p9Ky_2X7av26-iA.png" /></figure><p>Try clicking on the URL. If all went well, you’ll see.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*XUoz979zy-fI0ZP8mtx8fA.png" /></figure><p>Looks familiar? Create New Configuration. You’ll see a small warning which you can safely ignore (the reason is that the Dockerfile created /home/forgerock/openam for you — we’ll use that later as a mount point for a persistent volume).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/637/1*-v7w9goCIhCt09B_A7HsdA.png" /></figure><p>Leave “Configuration Directory” as is (really, DON’T change this unless you modify the Dockerfile). In the next window, put in the correct port numbers (since the pod isn’t properly DNS configured, AM configurator cannot determine the port numbers and defaults them to “-1”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*TOC7Lcz-f9_mTSdDDeVGaw.png" /></figure><p>Complete the installation and access AM via the service route (same URL as above).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/927/1*15Q9C23js84gOAntg-TpgQ.png" /></figure><p>Congratulation! Next: adding a persistent volume.</p><h4>Persistent volumes</h4><p>The above procedure puts the openam configuration directory inside the docker container (ie doesn’t do volume mapping). This is a bad thing if your pod crashes because your configuration would be lost. What we need on OpenShift is something that does the same job as volume mapping</p><blockquote>$ docker run — name am-eval -p 8080:8080 -v $PWD/openam-configuration:/home/forgerock/openam/ am-eval</blockquote><p>So let’s create a persistent volume. Navigate to the storage section</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*Afb5eXYuN3idbGS-26PDPw.png" /></figure><p>and “Create Storage”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/623/1*h2M35HDd3wLBE4CKYSnXWw.png" /></figure><p>Enter 4GiB (even though 2GiB should be finde as well).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*7E6ymLSG2FTPwDOm8gyD8w.png" /></figure><p>That was successful. Now let’s mount the new volume at mount point /home/forgerock/openam. In your deployment, select “Add Storage”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/681/1*fGHHQ9osWBIM9tEHg29ANg.png" /></figure><p>and enter a mount point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*7dmB1IJOMd7O6QehIqlPgw.png" /></figure><p>OpenShift will now rollout the new configuration (and your previous OpenAM configuration which didn’t reside on a persistent volume is lost). Thus, the configurator will show up again. However,if you proceed here, you’ll see that the port 50389 etc aren’t free. This is because your pod is still running. Simply delete the pod as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*2NF5KddwVVgF-fKH2BsWRg.png" /></figure><p>OpenShift will automatically create a new pod. Now, go to the same URL as before and re-run the configuration (this time you’ll see that 50389 etc is free). Since the configuration data now resides on a persistent volume, you can kill the pod without loosing your data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/779/1*qX5yn8LfLYLxBUiE5Dlm2A.png" /></figure><p>but still (after OpenShift fired up the new pod) you’ll see</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*IwmROEf-xKJ6PiIiWGJwrw.png" /></figure><p>(and thank’s to CTS, your session is still valid and you do not have to re-authenticate after a pod crashes/dies).</p><h4>Ready for CLI?</h4><p>Go to Part 2: <a href="https://medium.com/@scureq/forgerock-access-manager-on-openshift-part-2-991831c3fadf">https://medium.com/@scureq/forgerock-access-manager-on-openshift-part-2-991831c3fadf</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5711fe0b92b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using your own SNS messaging with ForgeRock Authenticator]]></title>
            <link>https://medium.com/@steffoweber/customizing-the-forgerock-authenticator-8b4cb23e7b8a?source=rss-913bac626aba------2</link>
            <guid isPermaLink="false">https://medium.com/p/8b4cb23e7b8a</guid>
            <category><![CDATA[push-notification]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[openam]]></category>
            <category><![CDATA[forgerock]]></category>
            <category><![CDATA[passwordless]]></category>
            <dc:creator><![CDATA[Steffo Weber]]></dc:creator>
            <pubDate>Fri, 21 Jul 2017 11:00:35 GMT</pubDate>
            <atom:updated>2017-07-21T11:12:44.938Z</atom:updated>
            <content:encoded><![CDATA[<p>Push Messages are an (relatively) easy way to communicate with a mobile phone. While similar to SMS messages, they are considered to be more secure and NIST eg recommends to favour messages over classical SMS.</p><p>ForgeRock Access Manager provides Push Authentication as a secure authentication mechanism which can leverage the TouchID of modern phones (iOS &amp; Android). ForgeRock further provides an mobile app which can</p><ul><li>register a smartphone for use w push authentication</li><li>receiving push messages and authenticating the user using the TouchID fingerprint mechanism</li></ul><p>This app is available on both Apple AppStore and Google Playstore. ForgeRock provides a push notification service via Amazon SNS. ForgeRock customers can easily subscribe to this service which send out push messages from both cloud-based and on-premise based ForgeRock Access Manager installations.</p><h3><strong>THE NEED FOR CUSTOMIZATION</strong></h3><p>The technology of push messages requires that the messaging service knows exactly which mobile app the message should be send to. In case of iOS, a mobile app is identified by a so-called <em>bundle identifier</em>. This bundle ID cannot be changed after the developer signed the app and submitted it to an app store. As a result, the <em>configuration of the message service must be changed whenever the app is modified</em> and vice versa. This is to prevent that persons who do not own or publish the app (i.e. the devleoping company) are able to send push messages to a certain app (suppose a potentially hostile entity could send messages to your WhatApp/LinkedIn app).</p><p>Thus,</p><blockquote><em>If you want to modify the app, you have to use your own AWS SNS service.</em></blockquote><p>and</p><blockquote><em>If you want to use your own AWS SNS service, you have to modify/recompile app with new bundle ID.</em></blockquote><p>In the following we’ll explain how to create your own SNS service and how to connect to Apple Push Notification Service (APNS) as well as Google Cloud Messaging (GCM). In a second article, we’ll explain what happens on the mobile app side and how to perform the app registration process (which is only touched briefly here).</p><h3><strong>SETTING UP SNS</strong></h3><p>To setup AWS SNS for ForgeRock Push Authentication you need:</p><ul><li>a valid AWS account</li><li>an Apple Developer account</li><li>a Google Firebase account</li></ul><h4>Create a keypair</h4><p>In a first step, you need to create a pub/priv keypair that will be uploaded as .p12 file to AWS. AWS uses this keypair to authenticate against APNS. To generate the keypair, you can eg use the Keychain app on Mac OS X. Start at <a href="http://developer.apple.com/">developer.apple.com</a> and login with your iOS developer account; select <em>Certificates, IDs &amp; Profiles</em>.</p><p><strong>Step 1a</strong>. Create an XCode project, enable Push Notifications and choose a new bundle ID. Alternatively you can checkout ForgeRock Authenticator and amend the bundle ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/506/1*F021oKPDB1sbRV46cNTGJg.png" /><figcaption>Change/create Bundle ID in XCode</figcaption></figure><p>The bundle ID should now show up in Apple developer console under “iOS App IDs”.</p><p><strong>Step 1b.</strong> We now create the keypair that AWS uses to access APNS. Add a dev or prod certificate for Push Notifications.</p><p>Now add a certificate for APNS.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*u5cZX5uBW1nrG4i_eu_ULA.png" /><figcaption>Create an app specific certificate (request) for use by SNS</figcaption></figure><p>Now, we have to select which application should receive the push notifications. Since an app is identified by the App ID (which matches the Bundle ID) we need eg to select “io.push.demo” in the screen that follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/436/1*dnhjMHTyXIw3u0IA1GWZbg.png" /><figcaption>Selecting the AppID t be used</figcaption></figure><p>The Apple wizzard will now guide you through the steps using Keychain tool to generate a CSR (Certificate Signing Request), submit it to Apple CA via developer console and the download it and import into Keychain.</p><p>In the Apple developer certificates section the new certificate appears with type “Apple Push Services”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/456/1*36ngT-0eWGDynUeDnbCDpA.png" /></figure><p>From Keychain you can create a PKCS12 version which has public and private part in one file. This file will be uploaded to your AWS SNS later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/453/1*ku5zpiCGp2Te6MTpyMSCJA.png" /></figure><p>This completes the preparation for iOS. Sure if you’re an experienced iOS developer there are a couple of shortcuts which we didn’t mention here.</p><h4><strong>Create a Google Cloud Messaging Service</strong></h4><p>Recently Google moved the creation of a GCM service to Firebase console. You need a Google cloud account to access console.firebase.google.com.</p><p>Next, create a new project</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*4BElAKqBKojJpQjEhpOCrQ.png" /><figcaption>Create a project for GCM service</figcaption></figure><p>and open settings</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/1*DSdtVr3TxrLGw5TJ83k51Q.png" /><figcaption>Retrieve API key for GCM which is needed by SNS to send messages via GCM from Settings.</figcaption></figure><p>In the page that follows is the project ID and an API key. You’ll need the API key in the next step to access GCM from the AWS SNS service.</p><h4><strong>Create SNS service</strong></h4><p><strong>Step 2a.</strong> Subscribe to SNS. Using AWS console (<a href="http://aws.amazon.com/console">aws.amazon.com/console</a>) goto AWS service and select Simple Notification Service (SNS)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*OsttdT_HVL8989kJsJAjQQ.png" /><figcaption>Enable SNS for your AWS account</figcaption></figure><p><strong>Step 2b</strong>. Select Create platform application. You’ll now have to provide the data to access APNS and GCM services. For APNS, do</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*-3_XsuTpjccydFt7k4Rbjw.png" /><figcaption>Tell SNS how to reach APNS</figcaption></figure><p><strong>Step 2c.</strong> Select “Choose P12 file”, provide password by which this file is protected (remember that this file contains both, your private and public key) and click “Load credentials from file”. The field containing certificates and private key should now be auto populated.</p><p><strong>Step 2d</strong>. Configure access to GCM accordingly. GCM uses an API key rather than a P12 but this is basically the same approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/390/1*GzGOU3Eg3e4dziWXrH4LOw.png" /><figcaption>Tell SNS how to reach GCM</figcaption></figure><p>If all goes well, your AWS SNS application shows up under applications together with their endpoint.</p><p>These endpoints look like arn:aws:sns:eu-west-1:0123456787:app/APNS_SANDBOX/FRDemo and need to be entered on Access Manager’s Push Service configuration.</p><p>To prevent people accessing the endpoints in AWS for APNS or GCM, these endpoint are protected with a clientID/clientSecret pair. To generate such a pair you need to create a user via AWS console using the IAM service. Make sure you tick the box for programmatic access.</p><p><strong>Step 2e</strong>. Click on “Attach existing policies directly” area</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*AKnlxKP_ru6MisBxzOv9_A.png" /></figure><p>Select the “AmazonSNSFullAccess” policy.</p><p><strong>Step 2f</strong>. You’re almost done. In IAM console select the user and retrieve Access Key ID and Secret Access Key. You can download those values as a CSV file</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/483/1*UcruAO7Fd2ofjRSxx7Ww4w.png" /></figure><p>That’s it. We can now configure OpenAM’s push service to use those values and give it a try.</p><h3><strong>DEBUGGING</strong></h3><p>If something goes wrong with registering the new app with the new SNS service, you can try if the app is able to receive push messages which are not issues by OpenAM. To do this, you can test push messages using Amazon’s AWS SDK</p><p><strong>Step 3a</strong>. Download ForgeRock authenticator’s source code. Simply replace the bundle ID as described earlier. Attach your iOS device to your Mac and run the app while the mobile phone is connected to XCode. Right after you allowed to receive Push Notification, you’ll see something like</p><p><strong>2017–07–20 08:46:29.111970+0200 ForgeRock[7354:2548462] Registered for remote notifications. deviceToken=&lt;8e0729bb 565fbddc bde0bd42 e06ecf2 4464f063 7932a580 73add12c ee6e3af7&gt;’</strong></p><p>in XCode console’s output. The deviceToken is a sort of phone number, that SNS must know in order to send a message to this sepcific device. This is exactly what happens during the the QR registration step. After a successful registration, OpenAM’s profile of a push user has an attribute <strong>pushDeviceProfiles</strong> which contains the deviceToken (among other data).</p><p><strong>Step 3b</strong>. Try to send push message to your device using AWS console or a NodeJS program like <a href="https://gist.github.com/tmarshall/6149ed2475f964cda3f5."><strong>https://gist.github.com/tmarshall/6149ed2475f964cda3f5</strong>.</a> To use NodeJS code, simply set the following parameters to match with your environment</p><ul><li>SNS Endpoints of the application</li><li>ID/Secret to access AWS</li><li>deviceToken</li><li>region (eg eu-west-1) where you created your service</li></ul><p>Alternatively, you can use AWS console. Goto SNS</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*LuIwVaiPloTjKuyyi1AcGQ.png" /></figure><p>service</p><p>and select your application. Click on the correct ARN (eg iOS for Apple devices). Now click on <strong>Create Endpoint</strong> (this will add a device specific endpoint).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/471/1*M_tD1yneoyjZzRIxgOIdZw.png" /><figcaption>Create a device specific endpoint using the device token</figcaption></figure><p>Enter deviceToken <strong>without spaces</strong> (you can leave User Data field empty) and <strong>publish a message</strong> this endpoint (eg “Long live Rock’n’Roll”). You should now receive this message on your phone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/419/1*ST7RGSQQf4-SqrJG47TkSA.png" /><figcaption>Send Push message to iOS app via AWS SNS console</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8b4cb23e7b8a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Using OpenAM for a scalable multi-tenant Meteor login service.]]></title>
            <link>https://medium.com/@steffoweber/using-openam-for-a-scalable-multi-tenant-meteor-login-service-93343358b893?source=rss-913bac626aba------2</link>
            <guid isPermaLink="false">https://medium.com/p/93343358b893</guid>
            <category><![CDATA[openam]]></category>
            <category><![CDATA[meteor]]></category>
            <category><![CDATA[aml]]></category>
            <dc:creator><![CDATA[Steffo Weber]]></dc:creator>
            <pubDate>Tue, 11 Aug 2015 08:50:39 GMT</pubDate>
            <atom:updated>2015-08-11T08:50:39.096Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://www.meteor.com/">Meteor JS</a> is one of the most interesting JavaScript platforms. When talking to non-technical people working in tech companies on why they should care about Meteor here are my main points:</p><ul><li>Meteor is #10 in GitHub</li><li>Meteor is funded by Andreessen/Horowitz</li><li>Meteor is backed by Heavybit industries (if you don’t know them, have a look at their projects)</li></ul><p>One reason for me to use Meteor is that I have a use-case of SaaS site which generates for each customer a Meteor instance (with its own Mongo database which could be shared or dedicated). This is a typical micro-site architecture: every new micro-site is generated from scratch via</p><ul><li>checkout the code from GitHub,</li><li>applying site-specific changes like initial user, custom styles/config etc.</li><li>build &amp; run Docker container</li><li>register the new site at the main load-balancer using etcd and confd</li></ul><p>Here’s more info on the use case (screenshots etc): <a href="http://slides.com/steffoweber/killing-dinosaurs">http://slides.com/steffoweber/killing-dinosaurs</a> slide 28ff.</p><p>Now the only thing, which prevents the micro-site factory (the site generating webapp) from generating a site pre-configured with a working “Login with Google” button is the fact, that there is no way to generate a new <em>Google OAuth2 ClientID</em> (together with callback URL, client secret etc) via an automated API call. This is still a manual process which is done in <em>Google’s Developer’s Console</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/596/1*rvd4lAdKoE1TYR2U_Nd3zA.png" /><figcaption>Connection of Meteor apps and Google OAuth.</figcaption></figure><h4>OpenAM as a central identity HUB</h4><p>There are propably a couple of solutions to this issue. My approach was to use <a href="https://forgerock.org/openam/">OpenAM</a> as a proxy between the micro-sites and Google. OpenAM can be installed &amp; configured quickly to allow Single-Sign-On with Google (see here for a video tutorial: <a href="http://www.fedji.com/blogs/forgerock/forgerock-openam-authentication-with-google-account-using-oauth2/">http://www.fedji.com/blogs/forgerock/forgerock-openam-authentication-with-google-account-using-oauth2/</a>). Now instead of pointing the micro-sites to Google OAuth2 directly (via accounts-google smart package), we use SAML2 to login to an OpenAM realm. The realm is configured to use a single authentication module (Google OAuth2). Thus, <strong>login in to OpenAM succeeds if and only if login to Google does</strong>. This is exactly what we want.</p><p>I therefore extended the Meteor SAML package by Nate Strausser to make it work with OpenAM (also adding single logout, metadata URLs etc); you can grab it from <a href="http://atmosphere.js/">atmospherejs.com</a> — just search for <a href="https://atmospherejs.com/steffo/meteor-accounts-saml">steffo:meteor-accounts-saml</a> (or click the link).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/619/1*bzuBBMKJG00OcWDxtPBYlw.png" /><figcaption>Architecture with OpenAM as identity hub.</figcaption></figure><h4>Importing new micro-site SPs in OpenAM</h4><p>When a new micro-site was build, its SAML metadata is — as part of the above atmosphere package — automatically provided at a certain URL eg</p><p>https://fred.saas.io/_saml/metadata/forgerock</p><p>The service-provider (SP) metadata needs to be imported by the IDP. In OpenAM this can done via GUI or CLI. Of course, we want to use CLI mode as our aim is to automate the whole process.</p><ol><li>Get the metadata XML via<br>curl <a href="http://shiva.init8.net:3000/_saml/metadata/forgerock">https://fred.saas.io/_saml/metadata/forgerock</a> &gt; /tmp/fred-sp.xml</li></ol><p>2. Import metadata in OpenAM using <em>ssoadm<br></em>./ssoadm import-entity -u amadmin -f /tmp/pwd.txt -t zimt<br>-e zimt -m /tmp/fred-sp.xml</p><p>Check <a href="https://backstage.forgerock.com/#!/docs/openam/12.0.0/reference/N101EA#ssoadm-import-entity">OpenAM docs</a> for the parameter. Et voila — that’s it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=93343358b893" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>