i'm following this tutorial in wso2 website, but there's no information where to put java Handler to make Authorization.
Is anyone know where to put that ? and how to make it working with API Resource ?
i'm following this tutorial in wso2 website, but there's no information where to put java Handler to make Authorization.
Is anyone know where to put that ? and how to make it working with API Resource ?
You can put this in handlers tag under the API, please check the tutorial sample code. This handler will apply to all resources.
<api xmlns="http://ws.apache.org/ns/synapse"
name="TestGoogle"
context="/search">
<resource methods="GET">
<inSequence>
<log level="full">
<property name="STATUS" value="***** REQUEST HITS IN SEQUENCE *****"/>
</log>
<send>
<endpoint>
<http method="get" uri-template="https://www.google.lk/search?q=wso2"/>
</endpoint>
</send>
</inSequence>
</resource>
<handlers>
<handler class="org.wso2.handler.SimpleOAuthHandler"/>
</handlers>
</api>
You can add the handler before the closing tag of the API, after saving it, API may not show the handler, but if you check the source view then you can see the handler assigned to the API. (Main -> Source View)
You have to copy the jar containing the handler to [ESB_HOME]/repository/component/lib
and restart the server. The handler is added to the API configuration as a child to <api>
as
<handlers>
<handler class="org.wso2.rest.BasicAuthHandler"/>
</handlers>