<div dir="ltr">Hey Seb, <div><br></div><div>I&#39;m trying to reproduce this but getting a Javascript error which is:</div><div><span style="color:rgb(255,0,0);font-family:Menlo,monospace;font-size:11px;line-height:12px;white-space:pre-wrap">Uncaught ReferenceError: NewLeadController is not defined from aerodoc</span><span style="color:rgb(255,0,0);font-family:Menlo,monospace;font-size:11px;line-height:12px;white-space:pre-wrap"> </span><br>
</div><div><span style="color:rgb(255,0,0);font-family:Menlo,monospace;font-size:11px;line-height:12px;white-space:pre-wrap"><br></span></div><div><font color="#000000" face="Menlo, monospace"><span style="font-size:11px;line-height:12px;white-space:pre-wrap">I think I followed the steps above, but I did change the version aerogear.unifiedpush.sender.version to 0.2.1-SNAPSHOT as I did not have 0.2.0-SNAPSHOT. Any ideas about this?</span></font></div>
<div><font color="#000000" face="Menlo, monospace"><span style="font-size:11px;line-height:12px;white-space:pre-wrap"><br></span></font></div><div><font color="#000000" face="Menlo, monospace"><span style="font-size:11px;line-height:12px;white-space:pre-wrap"><br>
</span></font></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 1 August 2013 21:01, Sebastien Blanc <span dir="ltr">&lt;<a href="mailto:scm.blanc@gmail.com" target="_blank">scm.blanc@gmail.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 dir="ltr"><p style="line-height:20px;margin-right:0px;font-size:15.199999809265137px;margin-left:0px;margin-bottom:15px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:0px!important">

Hi Folks,</p><p style="line-height:20px;margin-right:0px;font-size:15.199999809265137px;margin-left:0px;margin-bottom:15px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:0px!important">I&#39;m facing an issue and I hope you could help me on this.</p>

<p style="line-height:20px;margin-right:0px;font-size:15.199999809265137px;margin-left:0px;margin-bottom:15px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin-top:0px!important">My app is using ag-sec with  the @secure annotation and Resteasy.</p>

<h2 style="border-bottom-style:solid;border-bottom-width:1px;line-height:1.7;font-size:2em;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:1em 0px 15px;padding:0px;border-bottom-color:rgb(238,238,238)">
<a name="1403b41a3c86bad0_scenario-hitting-secured-endpoints-without-cors-webapp-deployed-in-the-same-domain" href="https://gist.github.com/sebastienblanc/6133102#scenario-hitting-secured-endpoints-without-cors-webapp-deployed-in-the-same-domain" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:0px;line-height:1" target="_blank"><span></span></a>Scenario: hitting secured endpoints without CORS (webapp deployed in the same domain)</h2>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">When the user has not the role specified by @secure I got an exception, as expected <a href="https://gist.github.com/sebastienblanc/6134149" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://gist.github.com/sebastienblanc/6134149</a></p>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">I assume it is because of this <a href="https://github.com/aerogear/aerogear-security/blob/master/src/main/java/org/jboss/aerogear/security/interceptor/SecurityInterceptor.java#L71" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://github.com/aerogear/aerogear-security/blob/master/src/main/java/org/jboss/aerogear/security/interceptor/SecurityInterceptor.java#L71</a> and, perfect, works as designed.</p>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">The server returns a nice 401 status to the client.</p><h2 style="border-bottom-style:solid;border-bottom-width:1px;line-height:1.7;font-size:2em;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:1em 0px 15px;padding:0px;border-bottom-color:rgb(238,238,238)">

<a name="1403b41a3c86bad0_testing-in-a-cors-configuration-web-client-running-under-another-domain" href="https://gist.github.com/sebastienblanc/6133102#testing-in-a-cors-configuration-web-client-running-under-another-domain" style="color:rgb(65,131,196);text-decoration:none;display:block;padding-left:30px" target="_blank"><span></span></a>Testing in a CORS configuration (web client running under another domain)</h2>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">Same scenario I&#39;m hitting a secure endpoint without having the role needed (BTW the OPTIONS preflights are handled without any errors).</p>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">I&#39;m getting the same exception from the server but this time no proper 401 answer sent back to the client, and on client side the request is just canceled.</p>

<ol style="padding-left:30px;line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px"><li>Reproduce it To repoduce this scenario here are the step :</li>
</ol><ul style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px;padding:0px 0px 0px 30px"><li>Clone this branch <a href="https://github.com/sebastienblanc/aerogear-push-quickstart-backend/tree/cors_tests" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://github.com/sebastienblanc/aerogear-push-quickstart-backend/tree/cors_tests</a> ,<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">mvn clean install</code> , <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">mvn jboss-as:deploy</code></li>

<li><p style="margin:15px 0px">Clone this branch : <a href="https://github.com/aerogear/aerogear-push-quickstart-web/tree/AGPUSH-160" style="color:rgb(65,131,196);text-decoration:none" target="_blank">https://github.com/aerogear/aerogear-push-quickstart-web/tree/AGPUSH-160</a> and deploy it, making sure it&#39;s not running on the same port as aerodoc backend (for instance<code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">python -m SimpleHTTPServer</code> )</p>

</li><li><p style="margin:15px 0px">Browse to the simple client (in case you use python webserver it will be <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">localhost:8000</code></p>

</li><li><p style="margin:15px 0px">Login With maria/123</p></li><li><p style="margin:15px 0px">Refresh the page : you should see the failure on retrieving the <code style="font-family:Consolas,&#39;Liberation Mono&#39;,Courier,monospace;font-size:12px;line-height:normal;margin:0px 2px;padding:0px 5px;border:1px solid rgb(221,221,221);background-color:rgb(248,248,248);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;white-space:nowrap">/leads</code> endpoints.</p>

</li></ul><p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">So, What I&#39;m looking for is to have a normal 401 status sent back to the client when using CORS, maybe someone has some ides about this ?</p>

<p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px"><br></p><p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">

Regards,</p><p style="line-height:20px;font-size:15.199999809265137px;font-family:Helvetica,arial,freesans,clean,sans-serif;margin:15px 0px">Seb</p></div>
<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></blockquote></div><br></div>