<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jun 17, 2014 at 8:51 PM, Matthias Wessendorf <span dir="ltr">&lt;<a href="mailto:matzew@apache.org" target="_blank">matzew@apache.org</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5">On Tue, Jun 17, 2014 at 7:17 PM, Bruno Oliveira <span dir="ltr">&lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">Hi Matthias, answer inline.<br>
<div><br>
On 2014-06-17, Matthias Wessendorf wrote:<br>
&gt; On Tue, Jun 17, 2014 at 4:26 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Good morning peeps,<br>
&gt; &gt;<br>
&gt; &gt; I have a problem to solve which might affect the Sender and<br>
&gt; &gt; all the related clients.<br>
&gt; &gt;<br>
&gt; &gt; Previously, the UPS Sender was protected by the basic authentication<br>
&gt; &gt; method[1], so anyone in possession of _PushApplicationID_ and<br>
&gt; &gt; _MasterSecret_ is able to send push messages.<br>
&gt; &gt;<br>
&gt; &gt; After the integration with Keycloak now everything under _/rest_<br>
&gt; &gt; is properly protect by KC which is totally correct. Our sender is under<br>
&gt; &gt; the same umbrella which means that now Bearer token authentication is<br>
&gt; &gt; required[2] and Basic authentication won&#39;t exist anymore.<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; The device (un)registration endpoints are hit by this as well<br>
&gt; (/rest/registry/device/*).<br>
<br>
</div>Currently Keycloak is protecting our endpoints under /rest/*<br>
<div><br>
&gt;<br>
&gt; I am wondering if it isn&#39;t it possible to keep those URLs protected via<br>
&gt; HTTP_BASIC, or does the keycloak.js usage deny this?<br>
<br>
</div>Is not the Keycloak.js usage responsible for this, but the correct<br>
configuration of the application atm. Please compare:<br>
<br>
- master branch:<br>
  <a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L56" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L56</a><br>


- keycloak.js branch:<br>
  <a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/keycloak.js/server/src/main/webapp/WEB-INF/web.xml#L33" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/keycloak.js/server/src/main/webapp/WEB-INF/web.xml#L33</a><br>


<br>
Now we&#39;re fully using Keycloak bearer tokens instead of Basic.<br></blockquote><div><br></div><div><br></div></div></div><div>Oh, I was following Bill&#39;s sample project, where he did not use the &#39;KEYCLOAK&#39; auth-method:</div>

<div><a href="https://github.com/keycloak/keycloak/blob/master/project-integrations/aerogear-ups/app/src/main/webapp/WEB-INF/web.xml#L44" target="_blank">https://github.com/keycloak/keycloak/blob/master/project-integrations/aerogear-ups/app/src/main/webapp/WEB-INF/web.xml#L44</a><br>

</div><div><br></div><div>But we had the exclusion working w/ the KEYCLOAK &#39;auth-method&#39;, but this goes back to our initial starts in Dec/Jan.</div><div>Here is a rebased commit based on your initial commit:</div>

<div><a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/2aabd073aaaafa79943ea41d2651f6f0c5e4248e/server/src/main/webapp/WEB-INF/web.xml#L42-L53" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/2aabd073aaaafa79943ea41d2651f6f0c5e4248e/server/src/main/webapp/WEB-INF/web.xml#L42-L53</a><br>

</div><div class=""><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div><br>
&gt;<br>
&gt; On master (plain keycloak; before keycloak.js usage) we are doing an<br>
&gt; exclude for those URLs:<br>
&gt; <a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L46-L52" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L46-L52</a><br>


<br>
</div>I tried to include your exclusions, but that didn&#39;t work for me.<br>
<div><br>
&gt;<br>
&gt;<br>
&gt; IMO if possible, keeping these &#39;exceptions&#39; (or excludes) under HTTP_BASIC<br>
&gt; would be the simplest solution, as that means none of our client SDKs<br>
&gt; (Android, iOS, Cordova, Node.js Sender, Java-Sendet etc) would require an<br>
&gt; update.<br>
<br>
</div>I had a chat with Stian and looks like it&#39;s possible to support both<br>
auth methods in a single app, but that would involve changes on Keycloak.<br>
It&#39;s just the matter of discuss with KC team.<br></blockquote><div><br></div></div><div>I don&#39;t think we need to enable to &lt;auth-method&gt; settings in our web.xml;</div></div></div></div></blockquote><div><br>
</div><div>I mean: I think there is no need to enable multiple &lt;auth-method&gt; args, as we had the exclusion already working at some point, using their KEYCLOAK auth-method</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>My initial hope was to be able to simply exclude a few URLs from the overall Keycloak protection, like the above referenced commit:</div>

<div><a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/2aabd073aaaafa79943ea41d2651f6f0c5e4248e/server/src/main/webapp/WEB-INF/web.xml#L42-L53" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/2aabd073aaaafa79943ea41d2651f6f0c5e4248e/server/src/main/webapp/WEB-INF/web.xml#L42-L53</a><br>

</div><div><br></div><div>That would be best as that would mean no API change at all, and our client-registration and sender SDKs could stay as they are.</div><div><div class="h5"><div><br></div><div><br></div><div> </div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">

<br>
My two cents is the fact that we should use bearer tokens only, instead<br>
of mix both auth methods in a single app — now that we have KC.<br>
And discuss the changes into our clients rather sooner than later.<br>
<br>
But I&#39;m open for whatever you guys think it&#39;s the best.<br>
<div><div><br>
<br>
&gt;<br>
&gt; -Matthias<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; The consequence of this is the basic form being presented when you try<br>
&gt; &gt; to send push notifications[3]. The problem didn&#39;t occur before, because<br>
&gt; &gt; we were just using Basic authentication[4] instead of Bearer tokens.<br>
&gt; &gt;<br>
&gt; &gt; Possible solutions:<br>
&gt; &gt;<br>
&gt; &gt; 1- After the removal of Basic authentication, move _PushApplicationID_<br>
&gt; &gt; and _MasterSecret to http headers like:<br>
&gt; &gt;<br>
&gt; &gt; -H &quot;PushApplicationID: XXXXXX&quot; -H &quot;MasterSecret: 42&quot;<br>
&gt; &gt;<br>
&gt; &gt; IMO it sounds correct and reasonable for me.<br>
&gt; &gt;<br>
&gt; &gt; 2. Create a role specific for the sender like _push-applications_ and<br>
&gt; &gt; dinamically add _PushApplicationID_ and _MasterSecret on Keycloak where:<br>
&gt; &gt;<br>
&gt; &gt; username: _PushApplicationID_<br>
&gt; &gt; password: _MasterSecret_<br>
&gt; &gt;<br>
&gt; &gt; The implications of this alternative is the fact of have to manage those<br>
&gt; &gt; credentials on the server side inclusion/exclusion/login<br>
&gt; &gt;<br>
&gt; &gt; 3. Implement another authentication provider specifically for the sender<br>
&gt; &gt; and Basic authentication[5]<br>
&gt; &gt;<br>
&gt; &gt; 4. Do nothing. The consequences of this alternative is to implement<br>
&gt; &gt; everything already done by Keycloak.js and manage session tokens by hand<br>
&gt; &gt; on the admin-ui.<br>
&gt; &gt;<br>
&gt; &gt; To me the first alternative seems to be more simple, but I really want<br>
&gt; &gt; your feedback on it, once it affects the whole project.<br>
&gt; &gt;<br>
&gt; &gt; [1] -<br>
&gt; &gt;<br>
&gt; &gt; <a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/6c1a0d3fedea8fb6ba918009fd8e9785779c151f/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/sender/PushNotificationSenderEndpoint.java#L56" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/6c1a0d3fedea8fb6ba918009fd8e9785779c151f/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/sender/PushNotificationSenderEndpoint.java#L56</a><br>


&gt; &gt;<br>
&gt; &gt; [2] -<br>
&gt; &gt; <a href="https://github.com/abstractj/aerogear-unifiedpush-server/tree/keycloak.js" target="_blank">https://github.com/abstractj/aerogear-unifiedpush-server/tree/keycloak.js</a><br>
&gt; &gt; [3] -<br>
&gt; &gt;<br>
&gt; &gt; <a href="http://photon.abstractj.org/AeroGear_UnifiedPush_Server_2014-06-17_10-00-09_2014-06-17_10-00-12.jpg" target="_blank">http://photon.abstractj.org/AeroGear_UnifiedPush_Server_2014-06-17_10-00-09_2014-06-17_10-00-12.jpg</a><br>


&gt; &gt;<br>
&gt; &gt; [4] -<br>
&gt; &gt;<br>
&gt; &gt; <a href="https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L57" target="_blank">https://github.com/aerogear/aerogear-unifiedpush-server/blob/master/server/src/main/webapp/WEB-INF/web.xml#L57</a><br>


&gt; &gt;<br>
&gt; &gt; [5] -<br>
&gt; &gt; <a href="https://github.com/keycloak/keycloak/tree/master/examples/providers/authentication-properties" target="_blank">https://github.com/keycloak/keycloak/tree/master/examples/providers/authentication-properties</a><br>


&gt; &gt;<br>
&gt; &gt; --<br>
&gt; &gt;<br>
&gt; &gt; abstractj<br>
&gt; &gt; _______________________________________________<br>
&gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Matthias Wessendorf<br>
&gt;<br>
&gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><br>
<br>
&gt; _______________________________________________<br>
&gt; aerogear-dev mailing list<br>
&gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a><br>
<br>
<br>
--<br>
<br>
abstractj<br>
_______________________________________________<br>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/aerogear-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/aerogear-dev</a></div></div></blockquote></div></div></div><div><div class="h5"><br><br clear="all">
<div><br></div>-- <br>Matthias Wessendorf <br>
<br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>

twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div></div></div>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Matthias Wessendorf <br><br>blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a>
</div></div>