aditi21
aditi21

Reputation: 7

Basic Authentication handler is working http protocol but not with https in wso2 ei

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

  1. enable https for the same if I try as same above and url 'https://localhost:8243/api' nothing happens
  2. I want to change the username:password to something else like newuser:password1

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

Answers (2)

ophychius
ophychius

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

jakub.voves
jakub.voves

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

Related Questions