首页 > 解决方案 > 无法通过 WSO2 EI 访问安全的后端服务

问题描述

我的要求是通过 WSO2 EI 6 调用安全的后端服务,所以我尝试如下添加属性中介和标头中介,但我无法访问安全 API。

<header name="Authorization" scope="transport" value="Bearer 1e127891-c430-3312-87ab-a2ba23ef8a4d"/>

整个 API 如下所示,

<?xml version="1.0" encoding="UTF-8"?>
<api context="/nexgen" name="ChainApis" publishSwagger="nexgen" xmlns="http://ws.apache.org/ns/synapse">
    <resource methods="GET" uri-template="/getProviders">
        <inSequence>
            <header name="Authorization" scope="transport" value="Bearer 1e127891-c430-3312-87ab-a2ba23ef8a4d"/>
            <send>
                <endpoint key="LdapTest"/>
            </send>
        </inSequence>
        <outSequence>
            <log>
                <property name="checklist" value="after call"/>
            </log>
            <send/>
        </outSequence>
        <faultSequence/>
    </resource>
</api>

Endpoint 如下所示。

<endpoint name="LdapTest" xmlns="http://ws.apache.org/ns/synapse">
    <http method="get" uri-template="https://******/***/1.0/getLdapUserData?userName=suresh">
        <suspendOnFailure>
            <initialDuration>-1</initialDuration>
            <progressionFactor>1.0</progressionFactor>
        </suspendOnFailure>
        <markForSuspension>
            <retriesBeforeSuspension>0</retriesBeforeSuspension>
        </markForSuspension>
    </http>

</endpoint>

I even tried with the below property mediator too 
<property expression="fn:concat('Bearer ', 'db9df6c0-dfd4-3fde-ba0f-b9a524f0c9b0')" name="Authorization" scope="transport" type="STRING" xmlns:ns="http://org.apache.synapse/xsd"/>


the below is the log i get in my log file.
TID: [-1234] [] [2020-02-07 14:35:56,703]  INFO {org.apache.synapse.mediators.builtin.LogMediator} -  
    To: /nexgen/getProviders, MessageID: urn:uuid:c0409753-deb4-4c28-8d1e-23db599b4296, 
    Direction: request, Envelope: 
    <?xml version='1.0' encoding='utf-8'?>
    <soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
    <soapenv:Body/>
    </soapenv:Envelope> 
    {org.apache.synapse.mediators.builtin.LogMediator}

标签: wso2wso2esbwso2carbonwso2ei

解决方案


推荐阅读