基本身份验证处理程序正在使用HTTP协议,但与WSO2 EI中的HTTP无关
我在 https://docs.wso2.com/m/mobile.action#page/33136403/header/securingapis-basicauthusingabasicauthhandler 。 按照相同的步骤遵循我可以使用http协议IE测试IE http:// localhost:8290/api/and basic auth username:password用户: 现在,我想在2件事下进行2件事,
- 使HTTPS适合相同 如果我在上面尝试一样尝试,并且url'https:// localhost:8243/api'什么也没发生,
- 我想更改用户名:password:http
for http和https之类的其他内容,我的api我的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="/">
<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>
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
- enable https for the same
if I try as same above and url 'https://localhost:8243/api' nothing happens - 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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以添加WSO2 EI版本和Java处理程序代码吗?
我带有HTTPS的基本授课作品。如果要更改用户名和密码,则必须更改默认Java代码,或者可以连接到Handler的本地USERSTORE或AD。
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.
您确定使用正确的端口吗? 8290的HTTP端口表明10。在这种情况下,HTTPS端口为8253而不是8243。这可能会导致“什么都没发生”。
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'.