Ibm mobilefirst 在IBM Worklight中授权HTTP适配器

Ibm mobilefirst 在IBM Worklight中授权HTTP适配器,ibm-mobilefirst,Ibm Mobilefirst,我正在努力使HTTP适配器请求正确执行到受保护的rss提要。我已经阅读了大量IBM文档,以及查找到已移动或“正在维护”IBM页面的死链接。不幸的是,我所找到的示例都没有显示如何授权此请求 在本例中,我尝试从IBMGreenium环境中的Connections安装访问rss提要 适配器XML: <?xml version="1.0" encoding="UTF-8"?> <wl:adapter name="exampleAdapter" xmlns:xsi="http:/

我正在努力使HTTP适配器请求正确执行到受保护的rss提要。我已经阅读了大量IBM文档,以及查找到已移动或“正在维护”IBM页面的死链接。不幸的是,我所找到的示例都没有显示如何授权此请求

在本例中,我尝试从IBMGreenium环境中的Connections安装访问rss提要

适配器XML:

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="exampleAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.worklight.com/integration"
    xmlns:http="http://www.worklight.com/integration/http">
    <displayName>feedRead</displayName>
    <description>feedRead</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>greenhouse.lotus.com</domain>
            <port>443</port>
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>
   <procedure name="getFeed" connectAs="server"/>
</wl:adapter>
如何传递访问此提要所需的凭据


谢谢

提要希望如何传递凭据?如果它使用的是基本身份验证,那么您可以对凭据进行base64编码,并将其传递到适配器调用的头中,如下所示:

function getFeed(){

    var input = {
            method  : 'get',
            headers: {Authorization: "Basic YWRtaW5Ad29ya2xpZ2h0LmlibTpjaGFuZ2VJdCE="},
            path : "/hello",            
            returnedContentType : 'plain'       
    };

    return WL.Server.invokeHttp(input);
}

您可以将身份验证机制指定为适配器XML文件的一部分。文档位于此处:

目前,我面前没有Worklight Studio的实例可供检查,但我可以想象,有一个适配器XML的设计视图或一些自动完成功能,可以帮助填写如何在
块中指定详细信息

示例:

<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="exampleAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.worklight.com/integration"
    xmlns:http="http://www.worklight.com/integration/http">
    <displayName>feedRead</displayName>
    <description>feedRead</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>greenhouse.lotus.com</domain>
            <port>443</port>
            <authentication>
                <basic/>
                <serverIdentity>
                    <username> ${user} </username>
                    <password> ${password} </password>
                </serverIdentity>
            </authentication>  
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>
   <procedure name="getFeed" connectAs="server"/>
</wl:adapter>

饲料阅读
饲料阅读
https
温室莲花网
443
${user}
${password}

太棒了!我以前见过这样的代码,但由于某些原因使用它时遇到了困难,这次它运行得非常完美。现在来了解如何通过siteminder进行身份验证…很有趣part@Nick我在哪里可以找到这样的基本身份验证文档?${user}和${password}变量存储在哪里?
<?xml version="1.0" encoding="UTF-8"?>
<wl:adapter name="exampleAdapter"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:wl="http://www.worklight.com/integration"
    xmlns:http="http://www.worklight.com/integration/http">
    <displayName>feedRead</displayName>
    <description>feedRead</description>
    <connectivity>
        <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
            <protocol>https</protocol>
            <domain>greenhouse.lotus.com</domain>
            <port>443</port>
            <authentication>
                <basic/>
                <serverIdentity>
                    <username> ${user} </username>
                    <password> ${password} </password>
                </serverIdentity>
            </authentication>  
        </connectionPolicy>
        <loadConstraints maxConcurrentConnectionsPerNode="2" />
    </connectivity>
   <procedure name="getFeed" connectAs="server"/>
</wl:adapter>