<div dir="ltr">Bill,<div><br></div><div>I redid everything and it is working now. Thanks :).<div><br></div><div>Thanks</div><div>Sam</div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 5, 2014 at 3:35 PM, Bill Burke <span dir="ltr">&lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@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">I doubt the version is the problem.<span class=""><br>
<br>
On 9/5/2014 3:23 PM, Red Samh wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Bill,<br>
<br>
I have rc1 and not rc2, let me check if it works in the newer version.<br>
It may be the version.<br>
<br>
Thanks<br>
Sam<br>
<br>
<br>
On Fri, Sep 5, 2014 at 3:13 PM, Red Samh &lt;<a href="mailto:redsamh@gmail.com" target="_blank">redsamh@gmail.com</a><br></span><span class="">
&lt;mailto:<a href="mailto:redsamh@gmail.com" target="_blank">redsamh@gmail.com</a>&gt;&gt; wrote:<br>
<br>
    Bill,<br>
<br>
    I am able to get the example to work and it is fine if I am calling<br>
    REST service to any other REST service (any number of hops). Does it<br>
    work if you try to access another web application (just submit a<br>
    form, access content or anything) that is authenticated by Keycloak<br>
    or Are you able to make a call from the REST Service to a web<br>
    application that is configured with Keycloak?<br>
<br>
    See attached explanation.<br>
<br>
    Thanks<br>
    Sam<br>
<br>
<br>
    On Fri, Sep 5, 2014 at 2:41 PM, Bill Burke &lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br></span><span class="">
    &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt; wrote:<br>
<br>
        You&#39;re going to have to elaborate on your problem as I was<br>
        unable to reproduce it.<br>
<br></span>
        I took examples/preconfigured-demo/__<u></u>customer-app and added the<span class=""><br>
        database/ projects Java files to it.  I was able to deploy this<br>
        application and do both web and bearer auth from the same war.<br>
<br>
        Are you using latest Keycloak?  1.0-rc2?<br>
<br>
        On 9/5/2014 1:31 PM, Red Samh wrote:<br>
<br>
<br>
            Thanks Bill, much appreciated. Is there something I can do<br>
            in the<br>
            interim even if it is a hack?. I was looking at adapter code<br>
            or even<br>
            something I can hardcode in the rest service to pull out the<br>
            user<br>
            information and make the call to the back end application?<br>
<br>
            Thanks<br>
            Sam<br>
<br>
            On Sep 5, 2014 1:19 PM, &quot;Bill Burke&quot; &lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;<br></span><span class="">
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a> &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;&gt; wrote:<br>
<br>
                 A pure servlet filter is on the roadmap, but it<br>
            wouldn&#39;t be as<br>
                 seemlessly integrated.  I&#39;ll take a look at your problem.<br>
<br>
                 On 9/5/2014 11:59 AM, Red Samh wrote:<br>
<br>
<br>
                     Eap 6.x, it would be nice if i could generalize to<br>
            any war<br>
                     deployed to<br>
                     to tomcat or jetty.<br>
<br>
                     Thanks<br>
                     Sam<br>
<br>
                     On Sep 5, 2014 11:51 AM, &quot;Bill Burke&quot;<br>
            &lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a> &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;<br>
                     &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a> &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;<br></span><div><div class="h5">
                     &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt; &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;&gt;&gt; wrote:<br>
<br>
                          Wildfly or JBoss EAP 6.x or JBoss AS 7.1?<br>
<br>
<br>
                          On 9/5/2014 11:49 AM, Red Samh wrote:<br>
<br>
                              Bill,<br>
<br>
                              Thanks for the reply.<br>
<br>
                              Yes it works when I have to call REST to<br>
            another REST<br>
                     service<br>
                              and any<br>
                              number of hops. The problem is calling a<br>
            full  fledged<br>
                              application from<br>
                              a REST service that I have the issue. When<br>
            it is an<br>
                     application<br>
                              that is<br>
                              both Web App + REST and I add the<br>
            authorization header<br>
                     (bearer)<br>
                              I get an<br>
                              unauthorized 401 (blackbox in the attachment).<br>
<br>
                              Thanks<br>
                              Sam<br>
<br>
<br>
                              On Fri, Sep 5, 2014 at 11:42 AM, Bill Burke<br>
                     &lt;<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a> &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;<br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a> &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;<br>
                              &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt; &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;&gt;<br>
                              &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt; &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;<br>
                     &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt; &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a><br>
            &lt;mailto:<a href="mailto:bburke@redhat.com" target="_blank">bburke@redhat.com</a>&gt;&gt;&gt;&gt;&gt; wrote:<br>
<br>
                                   Should work.  You&#39;ll have to actually<br>
            describe<br>
                     what your<br>
                              problem is or I<br>
                                   can&#39;t help you.  I&#39;ll take a guess<br>
            though:<br>
<br>
                                   Keycloak doesn&#39;t propagate the<br>
            Authorization<br>
                     bearer token<br>
                              header<br>
                                   automatically when you have multiple<br>
            REST &quot;hops&quot;<br>
                     between<br>
                              multiple<br>
                                   servers  You&#39;ll have to obtain the<br>
            access token<br>
                     and set up<br>
                              the HTTP<br>
                                   header manually.  The demo<br>
            customer-portal example<br>
                     in the<br>
                              distro does<br>
                                   exactly this, so take a look at that<br>
            for more details.<br>
<br>
                                   On 9/5/2014 10:58 AM, Red Samh wrote:<br>
                                    &gt; Hello,<br>
                                    &gt;<br>
                                    &gt; We have an application that is<br>
            protected using<br>
                     Keycloak<br>
                              and a<br>
                                   user can<br>
                                    &gt; access this application through a<br>
            web front.<br>
                     After login<br>
                              the user can<br>
                                    &gt; use the functionality of the<br>
            application. The<br>
                              application is also<br>
                                    &gt; exposed through REST API&#39;s and is<br>
            protected via<br>
                     keycloak<br>
                              as part<br>
                                   of the<br>
                                    &gt; application and accessible only<br>
            after login<br>
                     into the main<br>
                                   application.<br>
                                    &gt;<br>
                                    &gt; We have a<br>
                                    &gt;<br>
                                    &gt; (Step 1) Javascript application<br>
            (retrieving<br>
                     data from) -&gt;<br>
                                    &gt;<br>
                                    &gt; (Step 2) Business Application<br>
            exposed as REST<br>
                     API (REST<br>
                              API has<br>
                                   to make<br>
                                    &gt; calls to backend Application<br>
            mentioned above) -&gt;<br>
                                    &gt;<br>
                                    &gt; (Step 3) BackEnd Application<br>
            Server + REST API.<br>
                                    &gt;<br>
                                    &gt; Directly accessing the BackEnd<br>
            Application<br>
                     Server works<br>
                              fine but<br>
                                   when we<br>
                                    &gt; need to call the REST API from<br>
            another REST<br>
                     service which is<br>
                                    &gt; authenticated via Keycloak we have<br>
            issues.<br>
                                    &gt;<br>
                                    &gt; We used the existing sample to try<br>
            and do a POC<br>
                     but not<br>
                              sure what<br>
                                   is the<br>
                                    &gt; best approach to solve this issue.<br>
            The part<br>
                     from (Step<br>
                              1) to (Step 2)<br>
                                    &gt; works and the REST API is<br>
            protected using<br>
                     BEARER token.<br>
                              The (Step<br>
                                   2) to<br>
                                    &gt; (Step 3) is a problem as in (Step<br>
            2) we only<br>
                     have the BEARER<br>
                                   token and<br>
                                    &gt; the BackEnd Application is<br>
            protected using the<br>
                     full keycloak<br>
                                    &gt; configuration. So The BackEnd<br>
            Application<br>
                     service is not<br>
                                   authenticating<br>
                                    &gt; by sending in only the BEARER<br>
            token in the<br>
                     header which<br>
                              is a full<br>
                                    &gt; keycloak installation (work as<br>
            only a web service).<br>
                                    &gt;<br>
                                    &gt; Thanks<br>
                                    &gt; Sam<br>
                                    &gt;<br>
                                    &gt;<br>
                                    &gt;<br></div></div>
            ______________________________<u></u>_______________________<span class=""><br>
                                    &gt; keycloak-user mailing list<br>
                                    &gt; <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;<br>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.<br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.&gt;_<u></u>___<a href="http://jboss.org" target="_blank">jboss.org</a> &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;&gt;<br></span>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>&gt;.<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>&gt;.&gt;<u></u>______<a href="http://jboss.org" target="_blank">jboss.org</a><br>
            &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt; &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<span class=""><br>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.<br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.&gt;_<u></u>___<a href="http://jboss.org" target="_blank">jboss.org</a> &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;&gt;&gt;<br>
                                    &gt;<br></span>
            <a href="https://lists.jboss.org/______mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/______<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;<br>
<br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;__&gt;<span class=""><br>
<br>
<br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;<br>
<br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><br></span>
            &lt;<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;__&gt;__&gt;<span class=""><br>
                                    &gt;<br>
<br>
                                   --<br>
                                   Bill Burke<br>
                                   JBoss, a division of Red Hat<br>
            <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
<br></span>
            ______________________________<u></u>_______________________<span class=""><br>
                                   keycloak-user mailing list<br>
            <a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;<br>
            &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;<br>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.<br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.&gt;_<u></u>___<a href="http://jboss.org" target="_blank">jboss.org</a> &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;&gt;<br></span>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>&gt;.<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>&gt;.&gt;<u></u>______<a href="http://jboss.org" target="_blank">jboss.org</a><br>
            &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt; &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<span class=""><br>
                              &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.<br>
            &lt;mailto:<a href="mailto:keycloak-user@lists" target="_blank">keycloak-user@lists</a>.&gt;_<u></u>___<a href="http://jboss.org" target="_blank">jboss.org</a> &lt;<a href="http://jboss.org" target="_blank">http://jboss.org</a>&gt;<br>
                     &lt;mailto:<a href="mailto:keycloak-user@lists." target="_blank">keycloak-user@lists.</a>__<a href="http://jboss.org" target="_blank"><u></u>jboss.org</a><br>
            &lt;mailto:<a href="mailto:keycloak-user@lists.jboss.org" target="_blank">keycloak-user@lists.<u></u>jboss.org</a>&gt;&gt;&gt;&gt;<br></span>
            <a href="https://lists.jboss.org/______mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/______<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;<br>
<br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;__&gt;<span class=""><br>
<br>
<br>
            &lt;<a href="https://lists.jboss.org/____mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/____<u></u>mailman/listinfo/keycloak-user</a><br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;<br>
<br>
            &lt;<a href="https://lists.jboss.org/__mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/__<u></u>mailman/listinfo/keycloak-user</a><br></span>
            &lt;<a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/<u></u>mailman/listinfo/keycloak-user</a><u></u>&gt;__&gt;__&gt;<span class=""><br>
<br>
<br>
<br>
                          --<br>
                          Bill Burke<br>
                          JBoss, a division of Red Hat<br>
            <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
<br>
<br>
                 --<br>
                 Bill Burke<br>
                 JBoss, a division of Red Hat<br>
            <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
<br>
<br>
        --<br>
        Bill Burke<br>
        JBoss, a division of Red Hat<br>
        <a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
<br>
<br>
<br>
</span></blockquote><div class="HOEnZb"><div class="h5">
<br>
-- <br>
Bill Burke<br>
JBoss, a division of Red Hat<br>
<a href="http://bill.burkecentral.com" target="_blank">http://bill.burkecentral.com</a><br>
</div></div></blockquote></div><br></div>