首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何确保部署在最新的wso2ei 6.4.0中的REST服务的基本身份验证?

如何确保部署在最新的wso2ei 6.4.0中的REST服务的基本身份验证?
EN

Stack Overflow用户
提问于 2018-12-11 13:12:02
回答 1查看 227关注 0票数 0

我希望使用WSO2EI 6.4.0作为SOAP和REST服务身份验证平台(稍后可能是授权)的代理。我在wso2 (https://docs.wso2.com/display/EI640/Applying+Security+to+an+API)文档中找到了解决方案,但不幸的是它无法工作。

在服务定义中添加“处理程序”元素

代码语言:javascript
复制
<handlers>
    <handler class="org.wso2.carbon.integrator.core.handler.RESTBasicAuthHandler"/>
</handlers>

设计时(Eclipse)中的异常结果:

代码语言:javascript
复制
Invalid mediator <handler class="org.wso2.carbon.integrator.core.handler.RESTBasicAuthHandler"/>    1d6bbce1-08e3-42d5-b550-6a4e224b0028.xml    /.tmp/.org.wso2.developerstudio.eclipse.esb line 15 org.wso2.developerstudio.eclipse.gmf.esb.diagram.synapseerror

忽略和部署这样的API,会使API停止工作。

有人能帮忙吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2018-12-12 22:56:54

在WSO2EI 6.4.0中添加API基本身份验证的方式是正确的。开发者工作室会给出一个警告,正如你提到的,但它不应该是一个问题。Developer将允许设置处理程序,而不管警告如何,您应该能够创建一个包含API的复合应用程序,并将其部署到ESB。下面是一个带有RESTBasicAuthHandler的示例API。

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<api context="/testapi" name="testapi" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="POST" protocol="https" url-mapping="/*">
        <inSequence>
            <send>
                <endpoint name="testapi_EP">
                    <http uri-template="http://localhost:8080/testapi"/>
                </endpoint>
            </send>
        </inSequence>
        <outSequence/>
        <faultSequence/>
    </resource>
    <handlers>
        <handler class="org.wso2.carbon.integrator.core.handler.RESTBasicAuthHandler"/>
    </handlers>
</api>
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/53724906

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档