Reputation: 7
I am following the example 'Using a Basic Auth handler' at https://docs.wso2.com/m/mobile.action#page/33136403/header/SecuringAPIs-BasicAuthUsingaBasicAuthhandler. With the same steps followed I am able to test with http protocol i.e http://localhost:8290/api/ and basic auth username:password admin:admin Now I want to do below 2 things
For http and https my api looks like below:
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api" name="newAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/">
<inSequence></inSequence>
<outSequence/>
<faultSequence></faultSequence>
</resource>
<handlers>
<!-- <handler class="test1.BasicAuthHandler"/> -->
<handler class="org.wso2.rest.BasicAuthHandler"/>
</handlers>
</api>
<?xml version="1.0" encoding="UTF-8"?>
<api context="/api" name="newAPI" xmlns="http://ws.apache.org/ns/synapse">
<resource methods="GET" uri-template="/" protocol="https">
<inSequence></inSequence>
<outSequence/>
<faultSequence></faultSequence>
</resource>
<handlers>
<handler class="org.wso2.rest.BasicAuthHandler"/>
</handlers>
</api>
Upvotes: 0
Views: 199
Reputation: 2653
Are you sure you are using the correct port? The HTTP port of 8290 suggests an offset of 10. In that case the HTTPS port would be 8253 instead of 8243. That might cause that 'nothing happens'.
Upvotes: 0
Reputation: 117
can you add your WSO2 EI version and your java handler code? My basic auth with https works. If you want change username and password you must change your default java code or you can connect to local UserStore or AD from handler.
Upvotes: 1