<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Jul 2, 2013 at 4:35 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">Ahoy<br>
<div class="im"><br>
Matthias Wessendorf wrote:<br>
&gt;      &gt;<br>
&gt;      &gt; On Tue, Jul 2, 2013 at 11:48 AM, Bruno Oliveira<br>
&gt;     &lt;<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a> &lt;mailto:<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt;<br>
</div><div class="im">&gt;      &gt; &lt;mailto:<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a> &lt;mailto:<a href="mailto:bruno@abstractj.org">bruno@abstractj.org</a>&gt;&gt;&gt; wrote:<br>
&gt;      &gt;<br>
&gt;      &gt;     Good morning everyone, I&#39;m planning to include JWS (to add<br>
&gt;     digital<br>
&gt;      &gt;     signatures per mobile application)/JWT (to issue a token at each<br>
&gt;      &gt;     transaction or session) support on AeroGear and I was looking<br>
&gt;     at OAuth2<br>
&gt;      &gt;     bearer token (which make use of JWT/JWS behind the scenes)<br>
&gt;      &gt;     implementation from RESTEasy.<br>
&gt;      &gt;<br>
&gt;      &gt;     I was reading about how to properly include it and now we have a<br>
&gt;      &gt;     decision to make (we because it will affect the way the<br>
&gt;     client side and<br>
&gt;      &gt;     security is not an island :). RESTEasy bearer tokens is<br>
&gt;     completely tied<br>
&gt;      &gt;     to JBoss<br>
&gt;      &gt;<br>
&gt;     (<a href="http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1446" target="_blank">http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1446</a>)<br>
&gt;      &gt;     and I&#39;m not saying it is a bad thing, but with vert.x, TorqueBox,<br>
&gt;      &gt;     Nodej...I&#39;m not sure if it&#39;s a good idea.<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; That is because of (from the requirements): &quot;A username/password<br>
&gt;     based<br>
&gt;      &gt; JBoss security domain&quot;, right?<br>
&gt;      &gt;<br>
&gt;<br>
&gt;     Nope. This comes from the requirement &quot;add security to AG&quot; :)<br>
&gt;<br>
&gt;<br>
&gt; I was more asking about the &quot;completely tied to JBoss&quot; note.<br>
&gt;<br>
&gt; Is that because of &quot;...based JBoss security domain&quot; ?<br>
<br>
</div>Gotcha and yes. You must to setup security constraints on JBoss for it<br>
<a href="http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1657" target="_blank">http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1657</a><br>
and quoting the documentation &quot;You must though use FORM authentication&quot;<br>
(<a href="http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1654" target="_blank">http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1654</a>)<br>
<br>
I&#39;m not saying this is wrong, is just the framework design.<br></blockquote><div><br></div><div style>Ah...! :) Thanks for the iterations here :)  But yes, I agree that we do not want this!</div><div style>So a late +1 on your original statement :)  </div>
<div style><br></div><div style><br></div><div style><br></div><div style><br></div><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">

<div><div class="h5"><br>
&gt;<br>
&gt;     Username/Password are cool, the goal here is to add token between<br>
&gt;     client/server.<br>
&gt;<br>
&gt;     This token will come with timestamp, in this way if someone<br>
&gt;     eavesdropping your connection steal your username/password, the token<br>
&gt;     will be required.<br>
&gt;<br>
&gt;      &gt;<br>
&gt;      &gt;     An example of Bearer Token usage extracted from RFC<br>
&gt;      &gt;     (<a href="http://tools.ietf.org/html/rfc6750" target="_blank">http://tools.ietf.org/html/rfc6750</a>)<br>
&gt;      &gt;<br>
&gt;      &gt;            HTTP/1.1 200 OK<br>
&gt;      &gt;            Content-Type: application/json;charset=UTF-8<br>
&gt;      &gt;            Cache-Control: no-store<br>
&gt;      &gt;            Pragma: no-cache<br>
&gt;      &gt;<br>
&gt;      &gt;            {<br>
&gt;      &gt; &quot;access_token&quot;:&quot;mF_9.B5f-4.1JqM&quot;,<br>
&gt;      &gt; &quot;token_type&quot;:&quot;Bearer&quot;,<br>
&gt;      &gt; &quot;expires_in&quot;:3600,<br>
&gt;      &gt; &quot;refresh_token&quot;:&quot;tGzv3JOkF0XG5Qx2TlKWIA&quot;<br>
&gt;      &gt;            }<br>
&gt;      &gt;<br>
&gt;      &gt;     Pros: RESTEasy team already did it<br>
&gt;      &gt;     Cons: The configuration setup might be hard to newcomers<br>
&gt;     (please look at<br>
&gt;      &gt;     the documentation<br>
&gt;      &gt;<br>
&gt;     <a href="http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1446" target="_blank">http://docs.jboss.org/resteasy/docs/3.0.1.Final/userguide/html/oauth2.html#d4e1446</a>),<br>
&gt;      &gt;     we will be tied to JBoss.<br>
&gt;      &gt;<br>
&gt;      &gt;     So, do we have an alternative? Yes.<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; good :-)<br>
&gt;      &gt;<br>
&gt;      &gt;     Make use of JWT module only from<br>
&gt;      &gt;     RESTEasy<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; you mean only the JWT(==JSON Web Token) - not the &quot;bearer token&quot; ?<br>
&gt;<br>
&gt;     Yes.<br>
&gt;<br>
&gt;<br>
&gt; Ok<br>
&gt;<br>
&gt;<br>
&gt;      &gt;<br>
&gt;      &gt;     and we still can benefit of digital signatures and tokens.<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; The digital signatures would be still JWS (==JSON Web Signature) ?<br>
&gt;<br>
&gt;     Yup, to avoid confusion:<br>
&gt;<br>
&gt;     - JSON Web signatures: can be used to sign http requests against the<br>
&gt;     server  (do not replace the certificate) and avoid DDoS against the<br>
&gt;     server, non repudiation<br>
&gt;<br>
&gt;<br>
&gt; sounds good<br>
&gt;<br>
&gt;<br>
&gt;     - JSON Web token: another security layer (OPTIONAL). If for some reason<br>
&gt;     SSL was misconfigured, broken....you still have this layer of security<br>
&gt;     (this token is time-based, &quot;MACed&quot; and irreversible).<br>
&gt;<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt;     An example of JWT usage extracted from RFC<br>
&gt;      &gt;     (<a href="http://tools.ietf.org/html/draft-jones-json-web-token-10#page-6" target="_blank">http://tools.ietf.org/html/draft-jones-json-web-token-10#page-6</a>)<br>
&gt;      &gt;<br>
&gt;      &gt;     {<br>
&gt;      &gt; &quot;iss&quot;:&quot;joe&quot;,<br>
&gt;      &gt; &quot;exp&quot;:1300819380,<br>
&gt;      &gt; &quot;<a href="http://example.com/is_root" target="_blank">http://example.com/is_root</a>&quot;:true<br>
&gt;      &gt;     }<br>
&gt;      &gt;<br>
&gt;      &gt;     Pros: Flexibility, we have people already doing it<br>
&gt;      &gt;     (<a href="https://wiki.mozilla.org/WebAPI/WebPayment" target="_blank">https://wiki.mozilla.org/WebAPI/WebPayment</a>).<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; So our &quot;client side&quot; hook could be basically used with that<br>
&gt;     WebPayment<br>
&gt;      &gt; thing, right ?<br>
&gt;<br>
&gt;     No.<br>
&gt;<br>
&gt;     Sorry, I should explain that better, this is just an example. We will<br>
&gt;     not make use of WebPayment API, this is a snippet from Mozilla (I was<br>
&gt;     giving the credit, instead of just cut &amp; paste. And also showing an<br>
&gt;     example where JWT is used).<br>
&gt;<br>
&gt;<br>
&gt; :-) I was expecting we are not using the WebPayment.<br>
&gt;<br>
&gt; Perhaps my question was stupid - let me try again.<br>
&gt; If we have the JWT (e.g. on AG-JavaScript), could our bits could be used<br>
&gt; against a WebPayment Server ? (not sure if tehre is something).<br>
<br>
</div></div>There are no stupid questions, it must be clear to everybody. For<br>
authentication and digital signatures I would say, yes.<br></blockquote><div><br></div><div><br></div><div style>that&#39;s cool </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>
For transactions I doubt it, because they have specific requirements not<br>
present on AeroGear like:  pricePoint, icons, productData.......(also<br>
not present into the specification)<br></blockquote><div><br></div><div><br></div><div style>yeah, agree - I was more interested in the &quot;digital signatures&quot; part </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 class="im"><br>
&gt;<br>
&gt;<br>
&gt;     Into our project will be just JWT/JWS implementation with the RESTEasy<br>
&gt;     module.<br>
&gt;<br>
&gt;<br>
&gt; And since that is &quot;wrapped&quot; by AG-Security, it&#39;s not really tied to<br>
&gt; JBoss, since<br>
&gt; we could have other &quot;adapters&quot;, e.g. for Nodej/vert.x ?<br>
<br>
</div>That&#39;s the idea. </blockquote><div><br></div><div style>sound good.  Again +1 on the overall idea, and thanks for explaining!</div><div style><br></div><div style> <br></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">
As far as I know this RESTEasy module is not CDI<br>
dependent, so I&#39;d say it&#39;s possible.<br></blockquote><div><br></div><div style>@Dependent :) </div><div style><br></div><div style>I do not know, but good luck :) </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">

<div class="im"><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;      &gt;<br>
&gt;      &gt;     We will make use of<br>
&gt;      &gt;     RESTEasy module and do not reinvent the wheel.<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; +1 on reusing existing code. Not sure I fully understand (see my<br>
&gt;     above<br>
&gt;      &gt; comments on JWS/JWT :)<br>
&gt;<br>
&gt;     Feel free to ask, sorry for my bad explanation.<br>
&gt;<br>
&gt;<br>
&gt; I guess we are getting there :)<br>
&gt;<br>
&gt;<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt;     Cons: The authorization model must be implemented and adapted<br>
&gt;     to our<br>
&gt;      &gt;     needs<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; That could be done on-top of what we already have for AeroGear<br>
&gt;     Security ?<br>
&gt;<br>
&gt;     Yup, that&#39;s the idea.<br>
&gt;      &gt;<br>
&gt;      &gt;<br>
&gt;      &gt; -Matthias<br>
&gt;      &gt;<br>
<br>
<br>
</div><div class=""><div class="h5">--<br>
abstractj<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>