<div dir="ltr"><span style="color:rgb(0,0,0);font-size:12.8000001907349px">Hi!</span><div style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></div><div style="color:rgb(0,0,0);font-size:12.8000001907349px">One nice thing you could add to your post is the use of Postman REST Client App [1] (Chrome addon).</div><div style="color:rgb(0,0,0);font-size:12.8000001907349px">Postman offers a way to get an oAuth2 access_token (JWT) and add it to your request. All visually without have to get the access_token using &#39;curl&#39; or &#39;httpie&#39; (CLI utilities).</div><div style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></div><div style="color:rgb(0,0,0);font-size:12.8000001907349px">See Postman Helpers [2]. I used it for my demos when working with REST endpoints. I managed to get it working with the APIMan/Keycloak oauth2.</div><div style="color:rgb(0,0,0);font-size:12.8000001907349px"><br></div><div style="color:rgb(0,0,0);font-size:12.8000001907349px">[1] <a href="https://www.getpostman.com/" target="_blank">https://www.getpostman.com/</a></div><div style="color:rgb(0,0,0);font-size:12.8000001907349px">[2] <a href="https://www.getpostman.com/docs/helpers">https://www.getpostman.com/docs/helpers</a></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature">________________________<br>Rafael Torres Coelho Soares<br></div></div>
<br><div class="gmail_quote">On Tue, Sep 1, 2015 at 12:41 PM, Charles Moulliard <span dir="ltr">&lt;<a href="mailto:cmoullia@redhat.com" target="_blank">cmoullia@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Fixed after changing user parameter. I&#39;m able to get an access token<br>
<br>
So i will be able to take some screenshots now &amp; elaborate the instructions as addon of the excellent apiman &amp; keycloak blog article ;-)<br>
<br>
Sent from my iPhone<br>
<div class="HOEnZb"><div class="h5"><br>
&gt; On 1 sept. 2015, at 17:36, Charles Moulliard &lt;<a href="mailto:cmoullia@redhat.com">cmoullia@redhat.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Works better now. I have also reseted the password to demo and I get an account temporarily disabled<br>
&gt;<br>
&gt; Sent from my iPhone<br>
&gt;<br>
&gt;&gt; On 1 sept. 2015, at 17:22, Marc Savy &lt;<a href="mailto:marc.savy@redhat.com">marc.savy@redhat.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; <a href="http://localhost:8080/auth/admin/master/console/#/realms/demo/login-settings" rel="noreferrer" target="_blank">http://localhost:8080/auth/admin/master/console/#/realms/demo/login-settings</a> -&gt; &#39;Direct Grant API&#39; -&gt; ON<br>
&gt;&gt;<br>
&gt;&gt; Now, curl -X POST <a href="http://127.0.0.1:8080/auth/realms/demo/protocol/openid-connect/token" rel="noreferrer" target="_blank">http://127.0.0.1:8080/auth/realms/demo/protocol/openid-connect/token</a> -H &quot;Content-Type: application/x-www-form-urlencoded&quot; -d &quot;username=demo&quot; -d &#39;password=demo&#39; -d &#39;grant_type=password&#39; -d &#39;client_id=demo&#39;<br>
&gt;&gt;<br>
&gt;&gt; Works fine!<br>
&gt;&gt;<br>
&gt;&gt; As a side-note: I would also point your readers towards the Keycloak docs, as this may not be an optimal setup for their real-world requirements (e.g. they may want redirected login-screens, user registration, SAML, etc, etc).<br>
&gt;&gt;<br>
&gt;&gt;&gt; On 01/09/2015 15:54, Charles Moulliard wrote:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; On 01/09/15 11:57, Marc Savy wrote:<br>
&gt;&gt;&gt;&gt; I would suggest you refer to the Keycloak documentation, as there are<br>
&gt;&gt;&gt;&gt; several ways to skin this particular cat. For instance, how you decide<br>
&gt;&gt;&gt;&gt; to set up your Keycloak configuration is highly dependent upon your<br>
&gt;&gt;&gt;&gt; specific requirements; whether you want token grants to be via the<br>
&gt;&gt;&gt;&gt; API-only, or an HTTP redirect based approach (see:<br>
&gt;&gt;&gt;&gt; <a href="https://keycloak.github.io/docs/userguide/html/access-types.html" rel="noreferrer" target="_blank">https://keycloak.github.io/docs/userguide/html/access-types.html</a>); how<br>
&gt;&gt;&gt;&gt; you wish to divide up your application; the level of security you<br>
&gt;&gt;&gt;&gt; desire; any identity provision sources...<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; At any rate, once you have Keycloak going, you would log in and click<br>
&gt;&gt;&gt;&gt; on &#39;create realm&#39; (in my blog demo, that would be<br>
&gt;&gt;&gt;&gt; <a href="http://localhost:8080/auth/admin/master/console/#/create/realm" rel="noreferrer" target="_blank">http://localhost:8080/auth/admin/master/console/#/create/realm</a>) -<br>
&gt;&gt;&gt;&gt; then, add your client, roles, users, etc.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; I have created a very basic use case :<br>
&gt;&gt;&gt; - realm = demo,<br>
&gt;&gt;&gt; - a user = demo and<br>
&gt;&gt;&gt; - a client = demo where Direct Grants Only = ON and Access Type = Public<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; but when I issue a request to get the Access Token,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; curl -X POST<br>
&gt;&gt;&gt; <a href="http://127.0.0.1:8080/auth/realms/demo/protocol/openid-connect/token" rel="noreferrer" target="_blank">http://127.0.0.1:8080/auth/realms/demo/protocol/openid-connect/token</a> -H<br>
&gt;&gt;&gt; &quot;Content-Type: application/x-www-form-urlencoded&quot; -d &quot;username=demo&quot; -d<br>
&gt;&gt;&gt; &#39;password=demo&#39; -d &#39;grant_type=password&#39; -d &#39;client_id=demo&#39;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; I get  this error --&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; {&quot;error_description&quot;:&quot;Direct Grant REST API not<br>
&gt;&gt;&gt; enabled&quot;,&quot;error&quot;:&quot;not_enabled&quot;}<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Here is the demo.json exported file =<br>
&gt;&gt;&gt; <a href="https://gist.github.com/cmoulliard/c25fef751886ace8c354" rel="noreferrer" target="_blank">https://gist.github.com/cmoulliard/c25fef751886ace8c354</a><br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; To make your life simple for demo purposes, I suggest your clients be<br>
&gt;&gt;&gt;&gt; &#39;Direct Grants Only&#39; and &#39;Public&#39;.<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; I&#39;m not entirely clear from your email whether you want to script<br>
&gt;&gt;&gt;&gt; this, or provide walk-through steps, or provide a pre-baked config<br>
&gt;&gt;&gt;&gt; (like the blog).<br>
&gt;&gt;&gt;&gt;&gt; I would like to include instructions (= step by step instructions) +<br>
&gt;&gt;&gt; screenshots and also a file (= json exported config) for end users not<br>
&gt;&gt;&gt; interested to setup Keycloak<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Do you need to use roles and authorization? Or just simple<br>
&gt;&gt;&gt;&gt; authentication?<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt; Regards,<br>
&gt;&gt;&gt;&gt; Marc<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; On 01/09/2015 06:20, Charles Moulliard wrote:<br>
&gt;&gt;&gt;&gt;&gt; This blog refers to a link where we will import a pre-defined config<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; First, log into the Keycloak server. If you’re following our<br>
&gt;&gt;&gt;&gt;&gt; walkthrough, the log-in details are identical to those mentioned earlier<br>
&gt;&gt;&gt;&gt;&gt; (admin, admin123!). You can see that there is already an apiman realm<br>
&gt;&gt;&gt;&gt;&gt; defined, but we’re going to create a new one, so navigate to Add Realm<br>
&gt;&gt;&gt;&gt;&gt; (top right), and import and upload &quot;this demonstration realm definition<br>
&gt;&gt;&gt;&gt;&gt; - <a href="http://www.apiman.io/blog/resources/2015-06-04/stottie.json" rel="noreferrer" target="_blank">http://www.apiman.io/blog/resources/2015-06-04/stottie.json</a>&quot;; it<br>
&gt;&gt;&gt;&gt;&gt; provides an extremely simple setup where we have:<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; What I would like to explain how we can create this &quot;stottie&quot; config in<br>
&gt;&gt;&gt;&gt;&gt; Keycloak (step by step, screenshots)<br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; On 01/09/15 02:19, Eric Wittmann wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt; +1<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt; Thanks for responding, Rafael. I had intended to link this very same<br>
&gt;&gt;&gt;&gt;&gt;&gt; tutorial but then it slipped my mind. :)<br>
&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; On 8/31/2015 5:48 PM, Rafael Soares wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Charles,<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;   Recently I followed the &quot;/Keycloak and dagger: Securing your<br>
&gt;&gt;&gt;&gt;&gt; services<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; with OAuth2/&quot; tutorial [1] and it worked fine! This howto is great!<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; You don&#39;t need to do anything on the Fuse/Camel side. All setup is<br>
&gt;&gt;&gt;&gt;&gt; done<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; in the ApiMan side. ApiMan comes with a KeyCloak service embedded and<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; all you need to do is install the Apiman oauth2 keycloak plugin and<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; configure your service policy to use it. The tutorial [1]<br>
&gt;&gt;&gt;&gt;&gt; describes each<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; step in detail.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; [1]<br>
&gt;&gt;&gt;&gt;&gt; <a href="http://www.apiman.io/blog/gateway/security/oauth2/keycloak/authentication/authorization/2015/06/09/keycloak-oauth2.html" rel="noreferrer" target="_blank">http://www.apiman.io/blog/gateway/security/oauth2/keycloak/authentication/authorization/2015/06/09/keycloak-oauth2.html</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; ________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Rafael Torres Coelho Soares<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; On Mon, Aug 31, 2015 at 2:38 PM, Charles Moulliard<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; &lt;<a href="mailto:cmoulliard@redhat.com">cmoulliard@redhat.com</a> &lt;mailto:<a href="mailto:cmoulliard@redhat.com">cmoulliard@redhat.com</a>&gt;&gt; wrote:<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     Hi,<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     I have already asked this question but I need some help to<br>
&gt;&gt;&gt;&gt;&gt; figure<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; out<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     what are the steps required to setup Oauth 2 with Keycloak as<br>
&gt;&gt;&gt;&gt;&gt; I&#39;m<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     preparing a demo<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; (<a href="https://github.com/FuseByExample/rest-dsl-in-action" rel="noreferrer" target="_blank">https://github.com/FuseByExample/rest-dsl-in-action</a>)<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     covering the point about how to secure &amp; govern Camel REST DSL<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; endpoints<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     on JBoss Fuse using Apiman &amp; Keycloak ?<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     I just need the list of the steps to perform from the Web Site.<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Base on<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     the input, I will take some screenshots and include the<br>
&gt;&gt;&gt;&gt;&gt; instructions<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     within the demo content. Such input could be reused to write<br>
&gt;&gt;&gt;&gt;&gt; a blog<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     article too ;-)<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     Regards,<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     Charles<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     Apiman-user mailing list<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;     <a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a> &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a>&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/apiman-user</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; Apiman-user mailing list<br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/apiman-user</a><br>
&gt;&gt;&gt;&gt;&gt;<br>
&gt;&gt;&gt;&gt;&gt; _______________________________________________<br>
&gt;&gt;&gt;&gt;&gt; Apiman-user mailing list<br>
&gt;&gt;&gt;&gt;&gt; <a href="mailto:Apiman-user@lists.jboss.org">Apiman-user@lists.jboss.org</a><br>
&gt;&gt;&gt;&gt;&gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/apiman-user</a><br>
&gt;&gt;<br>
</div></div></blockquote></div><br></div>