<div dir="ltr"><div>Had to create a new version of my API and re-publish, but it worked. <br><br></div>Thank you.<br></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Jul 22, 2016 at 10:59 AM Eric Wittmann &lt;<a href="mailto:eric.wittmann@redhat.com">eric.wittmann@redhat.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Sure thing!  The problem is that the web.xml file in the<br>
apiman-gateway-api.war web application is too restrictive.  This is what<br>
I mean:<br>
<br>
<a href="https://github.com/apiman/apiman/blob/master/gateway/platforms/war/wildfly8/api/src/main/webapp/WEB-INF/web.xml#L40-L48" rel="noreferrer" target="_blank">https://github.com/apiman/apiman/blob/master/gateway/platforms/war/wildfly8/api/src/main/webapp/WEB-INF/web.xml#L40-L48</a><br>
<br>
That security constraint is too restrictive.  The<br>
&lt;web-resource-collection&gt; should specify which http methods to secure.<br>
Because it doesn&#39;t do this, *all* of the http methods are secured by<br>
default.  Here is an example that does it correctly with respect to CORS:<br>
<br>
<a href="https://github.com/apiman/apiman/blob/master/manager/api/war/wildfly8/src/main/webapp/WEB-INF/web.xml#L74-L82" rel="noreferrer" target="_blank">https://github.com/apiman/apiman/blob/master/manager/api/war/wildfly8/src/main/webapp/WEB-INF/web.xml#L74-L82</a><br>
<br>
So here&#39;s what you need to do:<br>
<br>
1) unpack WILDFLY/standalone/deployments/apiman-gateway-api.war<br>
2) open the WEB-INF/web.xml file in a text editor<br>
3) add the following XML markup after line 43:<br>
<br>
       &lt;http-method&gt;GET&lt;/http-method&gt;<br>
       &lt;http-method&gt;POST&lt;/http-method&gt;<br>
       &lt;http-method&gt;PUT&lt;/http-method&gt;<br>
       &lt;http-method&gt;DELETE&lt;/http-method&gt;<br>
       &lt;http-method&gt;HEAD&lt;/http-method&gt;<br>
<br>
4) save the web.xml changes<br>
5) re-zip everything, resulting in a new version of<br>
    apiman-gateway-api.war<br>
6) deploy the new version of apiman-gateway-api.war to Wildfly,<br>
    replacing the old version<br>
7) start wildfly<br>
8) profit!<br>
<br>
-Eric<br>
<br>
On 7/22/2016 8:23 AM, Jairo Junior wrote:<br>
&gt; I would like the workaround. =)<br>
&gt;<br>
&gt; On Fri, Jul 22, 2016 at 9:15 AM Eric Wittmann &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br>
&gt; &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     Thanks for the info.  You&#39;ve hit a bug in apiman, unfortunately.  I have<br>
&gt;     created a ticket for this bug here:<br>
&gt;<br>
&gt;        <a href="https://issues.jboss.org/browse/APIMAN-1209" rel="noreferrer" target="_blank">https://issues.jboss.org/browse/APIMAN-1209</a><br>
&gt;<br>
&gt;     You can resolve (workaround) this issue locally (without rebuilding<br>
&gt;     apiman) or you can wait for us to fix the bug and release a new version.<br>
&gt;       If you would like instructions on how to workaround the bug locally<br>
&gt;     let me know.<br>
&gt;<br>
&gt;     -Eric<br>
&gt;<br>
&gt;     On 7/22/2016 7:55 AM, Jairo Junior wrote:<br>
&gt;     &gt; EAP 7.0 + apiman 1.2.7 overlay, but I&#39;ve also tried with docker image<br>
&gt;     &gt; apiman/on-wildfly10:1.2.7.Final<br>
&gt;     &gt;<br>
&gt;     &gt; /apiman-gateway/org/service/1.0 with Keycloak OAuth Policy<br>
&gt;     &gt;<br>
&gt;     &gt; On Fri, Jul 22, 2016 at 8:29 AM Eric Wittmann<br>
&gt;     &lt;<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a> &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;<br>
&gt;     &gt; &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a><br>
&gt;     &lt;mailto:<a href="mailto:eric.wittmann@redhat.com" target="_blank">eric.wittmann@redhat.com</a>&gt;&gt;&gt; wrote:<br>
&gt;     &gt;<br>
&gt;     &gt;     Apiman should allow OPTIONS requests without requiring<br>
&gt;     authorization.<br>
&gt;     &gt;     What is your setup/configuration (which app server, etc)?<br>
&gt;     Also what<br>
&gt;     &gt;     apiman REST endpoints are you trying to access?<br>
&gt;     &gt;<br>
&gt;     &gt;     -Eric<br>
&gt;     &gt;<br>
&gt;     &gt;     On 7/22/2016 7:22 AM, Jairo Junior wrote:<br>
&gt;     &gt;     &gt; I&#39;ve been trying to setup apiman + keycloak-oauth-plugin +<br>
&gt;     keycloak +<br>
&gt;     &gt;     &gt; keycloak.js with a client-side angularjs app and a REST API.<br>
&gt;     It&#39;s a<br>
&gt;     &gt;     &gt; scenario very similar to<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;<br>
&gt;      <a href="https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular-product-app" rel="noreferrer" target="_blank">https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular-product-app</a>,<br>
&gt;     &gt;     &gt; but with apiman and CORS.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; My test are going well with curl, but using my javascript<br>
&gt;     app the<br>
&gt;     &gt;     &gt; browser it is performing a CORS preflight OPTIONS request<br>
&gt;     without<br>
&gt;     &gt;     &gt; authorization header.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; OPTIONS request works well with authorization header using curl,<br>
&gt;     &gt;     &gt; therefore, I&#39;m not sure whether the browser should include<br>
&gt;     &gt;     authorization<br>
&gt;     &gt;     &gt; header or apiman should allows CORS preflight requests (OPTIONS)<br>
&gt;     &gt;     without<br>
&gt;     &gt;     &gt; authorization header.<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;     &gt; _______________________________________________<br>
&gt;     &gt;     &gt; Apiman-user mailing list<br>
&gt;     &gt;     &gt; <a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a><br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a>&gt;<br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a><br>
&gt;     &lt;mailto:<a href="mailto:Apiman-user@lists.jboss.org" target="_blank">Apiman-user@lists.jboss.org</a>&gt;&gt;<br>
&gt;     &gt;     &gt; <a href="https://lists.jboss.org/mailman/listinfo/apiman-user" rel="noreferrer" target="_blank">https://lists.jboss.org/mailman/listinfo/apiman-user</a><br>
&gt;     &gt;     &gt;<br>
&gt;     &gt;<br>
&gt;<br>
</blockquote></div>