使用 WSO2 AM 向现有 API 添加身份验证

Add authentication to an existed API using WSO2 AM

我使用 WSO2 EI 创建了一个 API,看起来像 https://localhost:8243/services/ABC

然后我想创建另一个 API 作为端点,它高于 API 以添加身份验证。那么如何将值传递给 URL 模式和端点以获取它?

当URL形态为/xyz,终点为https://localhost:8243/services/ABC。它指向 https://localhost:8243/services/ABC/xyz 那不是我的端点。

非常感谢!

据我了解,您正试图通过在 APIM 中创建的 API 调用后端 https://localhost:8243/services/ABC。您可以尝试以下方法来实现它,

在APIM中创建的API中,您可以简单地添加URL https://localhost:8243/services作为端点,然后创建一个资源路径为/ABC.

您可以将自定义序列附加到 API。

<sequence xmlns="http://ws.apache.org/ns/synapse" name="header_sequence">

   <property name="REST_URL_POSTFIX" scope="axis2" action="remove"/>
       
</sequence>

这会丢弃资源而不是附加到路径。

请参考- https://apim.docs.wso2.com/en/latest/deploy-and-publish/deploy-on-gateway/api-gateway/message-mediation/mapping-the-parameters-of-your-backend-urls-with-the-api-publisher-urls/#mapping-the-parameters-of-your-backend-urls-with-the-api-publisher-urls