简体   繁体   English

基本身份验证处理程序正在使用 http 协议,但在 wso2 ei 中不使用 https

[英]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 .我正在关注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 ie http://localhost:8290/api/ and basic auth username:password admin:admin Now I want to do below 2 things遵循相同的步骤,我可以使用 http 协议进行测试,即 http://localhost:8290/api/ 和基本身份验证用户名:密码 admin:admin 现在我想做以下两件事

  1. enable https for the same if I try as same above and url 'https://localhost:8243/api' nothing happens如果我尝试与上面相同并且 url 'https://localhost:8243/api' 没有任何反应,则启用 https 相同
  2. I want to change the username:password to something else like newuser:password1我想将 username:password 更改为 newuser:password1 之类的其他内容

For http and https my api looks like below:对于 http 和 https,我的 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>

can you add your WSO2 EI version and your java handler code?你能添加你的 WSO2 EI 版本和你的 java 处理程序代码吗? My basic auth with https works.我使用 https 的基本身份验证有效。 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.如果您想更改用户名和密码,您必须更改您的默认 java 代码,或者您可以从处理程序连接到本地 UserStore 或 AD。

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'. HTTP 端口 8290 表示偏移量为 10。在这种情况下,HTTPS 端口将是 8253 而不是 8243。这可能会导致“什么都没有发生”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM