<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Jun 20, 2013 at 5:32 PM, Kris Borchers <span dir="ltr">&lt;<a href="mailto:kris@redhat.com" target="_blank">kris@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"><div class="im"><br>
On Jun 20, 2013, at 10:28 AM, Bruno Oliveira &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt; wrote:<br>
<br>
&gt; Just one addition <a href="http://tools.ietf.org/html/rfc2617#section-4" target="_blank">http://tools.ietf.org/html/rfc2617#section-4</a><br>
<br>
</div>Right … even on the iOS and Android side of things, it is still very easy to &quot;decrypt&quot; a base64 encoded string. Using HTTPS would help but that is not foolproof either so we may want to think of some other method.<br>
</blockquote><div><br></div><div><br></div><div style>sure  - and nothing new here :) </div><div style>But better than nothing, for now <br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<div class="HOEnZb"><div class="h5">&gt;<br>
&gt; Bruno Oliveira wrote:<br>
&gt;&gt; Don&#39;t feel safe because you&#39;re doing something with Base64 or using<br>
&gt;&gt; basic authentication. It doesn&#39;t guarantee safety, the HTTP Basic<br>
&gt;&gt; Authentication scheme is not considered a secure method without TLS/SSL,<br>
&gt;&gt; because username and password are passed over the network in cleartext.<br>
&gt;&gt;<br>
&gt;&gt; For this reason we will replace it with Digest or Hawk into the near<br>
&gt;&gt; future.<br>
&gt;&gt;<br>
&gt;&gt; Matthias Wessendorf wrote:<br>
&gt;&gt;&gt; Hi,<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; with the use of this helper<br>
&gt;&gt;&gt; &lt;<a href="https://github.com/davidchambers/Base64.js" target="_blank">https://github.com/davidchambers/Base64.js</a>&gt;, it is &quot;safe&quot; (I think) to<br>
&gt;&gt;&gt; use the |window.btoa| function(see details<br>
&gt;&gt;&gt; &lt;<a href="https://developer.mozilla.org/en-US/docs/Web/API/window.btoa" target="_blank">https://developer.mozilla.org/en-US/docs/Web/API/window.btoa</a>&gt;), to<br>
&gt;&gt;&gt; perform a (simple) Base64 encoding.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Base64 encoding is required, since the &quot;Device Registration&quot; HTTP REST<br>
&gt;&gt;&gt; endpoint now uses HTTP_Basic (for details see the matching thread<br>
&gt;&gt;&gt; &lt;<a href="http://lists.jboss.org/pipermail/aerogear-dev/2013-June/003233.html" target="_blank">http://lists.jboss.org/pipermail/aerogear-dev/2013-June/003233.html</a>&gt;).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Currently we perform this code for &quot;channel registration&quot;:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; |$.ajax({<br>
&gt;&gt;&gt; contentType:&quot;application/json&quot;,<br>
&gt;&gt;&gt; dataType:&quot;json&quot;,<br>
&gt;&gt;&gt; type:&quot;POST&quot;,<br>
&gt;&gt;&gt; url: url,<br>
&gt;&gt;&gt; headers: {<br>
&gt;&gt;&gt; &quot;ag-mobile-variant&quot;: variantID<br>
&gt;&gt;&gt; },<br>
&gt;&gt;&gt; data: JSON.stringify({<br>
&gt;&gt;&gt; category: messageType,<br>
&gt;&gt;&gt; deviceToken: endpoint.channelID,<br>
&gt;&gt;&gt; clientIdentifier: alias<br>
&gt;&gt;&gt; })<br>
&gt;&gt;&gt; });<br>
&gt;&gt;&gt; |<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; As mentioned on the &quot;Security thread&quot;, the |variantID| is no longer a<br>
&gt;&gt;&gt; header, it is part of the HTTP_Basic auth process.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; This is a (local) JavaScript change that I did. It works fine so far:<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; |$.ajax({<br>
&gt;&gt;&gt; contentType:&quot;application/json&quot;,<br>
&gt;&gt;&gt; dataType:&quot;json&quot;,<br>
&gt;&gt;&gt; type:&quot;POST&quot;,<br>
&gt;&gt;&gt; crossDomain: true,<br>
&gt;&gt;&gt; url: url,<br>
&gt;&gt;&gt; headers: {<br>
&gt;&gt;&gt; &quot;Authorization&quot;:&quot;Basic&quot; + window.btoa(variantID +&quot;:&quot; + secret)<br>
&gt;&gt;&gt; },<br>
&gt;&gt;&gt; data: JSON.stringify({<br>
&gt;&gt;&gt; category: messageType,<br>
&gt;&gt;&gt; deviceToken: endpoint.channelID,<br>
&gt;&gt;&gt; alias: alias ///// NOTE:: the key has changed..........<br>
&gt;&gt;&gt; })<br>
&gt;&gt;&gt; });<br>
&gt;&gt;&gt; |<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The important thing: we add the |&quot;Authorization&quot;: &quot;Basic &quot;| header and<br>
&gt;&gt;&gt; using the mentioned|window.btoa()| function for the actual encoding.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; The same applies for the |DELETE| (unregistration).<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Any thoughts? Otherwise, I&#39;d send a PR.<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; Ah.... the dependency agains the |Base64.js| polyfill library<br>
&gt;&gt;&gt; would/should be included in our &quot;grunt&quot; build for &quot;distribution&quot;, or<br>
&gt;&gt;&gt; would it be &quot;just&quot; declared (yeah, that&#39;s details but asking for<br>
&gt;&gt;&gt; curiousity)<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; --<br>
&gt;&gt;&gt; Matthias Wessendorf<br>
&gt;&gt;&gt;<br>
&gt;&gt;&gt; blog: <a href="http://matthiaswessendorf.wordpress.com/" target="_blank">http://matthiaswessendorf.wordpress.com/</a><br>
&gt;&gt;&gt; sessions: <a href="http://www.slideshare.net/mwessendorf" target="_blank">http://www.slideshare.net/mwessendorf</a><br>
&gt;&gt;&gt; twitter: <a href="http://twitter.com/mwessendorf" target="_blank">http://twitter.com/mwessendorf</a><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">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;<br>
&gt; --<br>
&gt; abstractj<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; aerogear-dev mailing list<br>
&gt; <a href="mailto:aerogear-dev@lists.jboss.org">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>
aerogear-dev mailing list<br>
<a href="mailto:aerogear-dev@lists.jboss.org">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><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>