<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, Jun 18, 2014 at 12:22 AM, 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:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>On 2014-06-17, Matthias Wessendorf wrote:<br>
</div><div><div>&gt; Bom Dia!<br>
&gt;<br>
&gt;<br>
&gt; On Tue, Jun 17, 2014 at 7:23 PM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt; wrote:<br>
&gt;<br>
&gt; &gt; Ahoy Jay, answers inline.<br>
&gt; &gt;<br>
&gt; &gt; On 2014-06-17, Jay Balunas wrote:<br>
&gt; &gt; &gt; Great explanation of the issue and options!<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; On Jun 17, 2014, at 10:26 AM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org" target="_blank">bruno@abstractj.org</a>&gt;<br>
&gt; &gt; wrote:<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Good morning peeps,<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; I have a problem to solve which might affect the Sender and<br>
&gt; &gt; &gt; &gt; all the related clients.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Previously, the UPS Sender was protected by the basic authentication<br>
&gt; &gt; &gt; &gt; method[1], so anyone in possession of _PushApplicationID_ and<br>
&gt; &gt; &gt; &gt; _MasterSecret_ is able to send push messages.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; After the integration with Keycloak now everything under _/rest_<br>
&gt; &gt; &gt; &gt; is properly protect by KC which is totally correct. Our sender is under<br>
&gt; &gt; &gt; &gt; the same umbrella which means that now Bearer token authentication is<br>
&gt; &gt; &gt; &gt; required[2] and Basic authentication won&#39;t exist anymore.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; The consequence of this is the basic form being presented when you try<br>
&gt; &gt; &gt; &gt; to send push notifications[3]. The problem didn&#39;t occur before, because<br>
&gt; &gt; &gt; &gt; we were just using Basic authentication[4] instead of Bearer tokens.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; Possible solutions:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; 1- After the removal of Basic authentication, move _PushApplicationID_<br>
&gt; &gt; &gt; &gt; and _MasterSecret to http headers like:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; -H &quot;PushApplicationID: XXXXXX&quot; -H &quot;MasterSecret: 42&quot;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; IMO it sounds correct and reasonable for me.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; How will this impact CURL usage from the command line?<br>
&gt; &gt; &gt; How will this impact Java sender usage?<br>
&gt; &gt;<br>
&gt; &gt; We would change from (being logged in would be required):<br>
&gt; &gt;<br>
&gt; &gt; curl -3 -u &quot;{PushApplicationID}:{MasterSecret}&quot;<br>
&gt; &gt;    -v -H &quot;Accept: application/json&quot; -H &quot;Content-type: application/json&quot;<br>
&gt; &gt;       -X POST<br>
&gt; &gt;<br>
&gt; &gt; To:<br>
&gt; &gt;<br>
&gt; &gt; curl -3<br>
&gt; &gt;    -v -H &quot;PushApplicationID: XXXXXX&quot; -H &quot;MasterSecret: 42&quot; \<br>
&gt; &gt;       -H &quot;Accept: application/json&quot; -H &quot;Content-type: application/json&quot;<br>
&gt; &gt;       -X POST<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt;<br>
&gt;<br>
&gt; That sounds like the most safe change to our client-registration and sender<br>
&gt; SDKs. Basically a &#39;minor&#39; change where we issue the HTTP request.<br>
&gt;<br>
&gt; I&#39;d vote for this change, but only if it is not possible to exclude a few<br>
&gt; URLs from Keycloak ;-)<br>
<br>
</div></div>Thanks Matthias, we will try to find a consensus on it.<br></blockquote><div><br></div><div>+ 9001 , let&#39;s be pragmatic and join brains :) </div><div><br></div><div>One question, Are you worried especially about accessing the send endpoint through the Admin client (through &quot;Send notififcation&quot;)  ? Because for that we could do some kind of facade protected (implicitly) by KC and later we could fully protect the endpoint  =&gt; this way for 0.11, the admin console is secured , we don&#39;t change the Sender API for now but we can do that for 0.12 .</div>
<div>wdyt ? </div><div>Otherwise let&#39;s go for solution 1.  </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
&gt;<br>
&gt; Note, that those excluded endpoints (for device-registration and sender)<br>
&gt; don&#39;t require any &lt;auth-method&gt; setting in web.xml,<br>
&gt; as they implement their own simple HTTP_BASIC handling by querying our<br>
&gt; database ;-)<br>
&gt; <a href="https://github.com/abstractj/aerogear-unifiedpush-server/blob/keycloak.js/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/sender/PushNotificationSenderEndpoint.java#L55-L61" target="_blank">https://github.com/abstractj/aerogear-unifiedpush-server/blob/keycloak.js/jaxrs/src/main/java/org/jboss/aerogear/unifiedpush/rest/sender/PushNotificationSenderEndpoint.java#L55-L61</a><br>


<br>
</div>If you look at KC examples[1], most of them properly make use of<br>
auth-method. IMO it&#39;s necessary if we want to benefit of bearer tokens<br>
on the admin-ui (I can be wrong on my understanding).<br>
<div><div><br>
<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; But, yeah - if the exclusion is not possible at all, I like your suggested<br>
&gt; header usage fix. IMO that&#39;s the one with the fewest risks.<br>
&gt;<br>
&gt;<br>
&gt; -Matthias<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; 2. Create a role specific for the sender like _push-applications_ and<br>
&gt; &gt; &gt; &gt; dinamically add _PushApplicationID_ and _MasterSecret on Keycloak<br>
&gt; &gt; where:<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; username: _PushApplicationID_<br>
&gt; &gt; &gt; &gt; password: _MasterSecret_<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; The implications of this alternative is the fact of have to manage<br>
&gt; &gt; those<br>
&gt; &gt; &gt; &gt; credentials on the server side inclusion/exclusion/login<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Would each application have its own &quot;role&quot; just for the sender in this<br>
&gt; &gt; case?<br>
&gt; &gt;<br>
&gt; &gt; Each application would have the same role &quot;ups-application&quot;.<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; 3. Implement another authentication provider specifically for the<br>
&gt; &gt; sender<br>
&gt; &gt; &gt; &gt; and Basic authentication[5]<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Not sure of the impact here, but sounds like a complex solution.<br>
&gt; &gt;<br>
&gt; &gt; Yes, totally agree on that.<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; 4. Do nothing. The consequences of this alternative is to implement<br>
&gt; &gt; &gt; &gt; everything already done by Keycloak.js and manage session tokens by<br>
&gt; &gt; hand<br>
&gt; &gt; &gt; &gt; on the admin-ui.<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; -1<br>
&gt; &gt;<br>
&gt; &gt; Stian sent to me a message, he might have more ideas about how to<br>
&gt; &gt; overcome this issue. I will update you guys during this week.<br>
&gt; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; To me the first alternative seems to be more simple, but I really want<br>
&gt; &gt; &gt; &gt; your feedback on it, once it affects the whole project.<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; [1] -<br>
&gt; &gt; &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; &gt; &gt;<br>
&gt; &gt; &gt; &gt; [2] -<br>
&gt; &gt; &gt; &gt;<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; &gt; &gt; [3] -<br>
&gt; &gt; &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; &gt; &gt;<br>
&gt; &gt; &gt; &gt; [4] -<br>
&gt; &gt; &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; &gt; &gt;<br>
&gt; &gt; &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; &gt; &gt;<br>
&gt; &gt; &gt; &gt; --<br>
&gt; &gt; &gt; &gt;<br>
&gt; &gt; &gt; &gt; abstractj<br>
&gt; &gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; &gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &gt; &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; &gt;<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; aerogear-dev mailing list<br>
&gt; &gt; &gt; <a href="mailto:aerogear-dev@lists.jboss.org" target="_blank">aerogear-dev@lists.jboss.org</a><br>
&gt; &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; &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><br>
</div></div></blockquote></div><br></div></div>