在IBM Worklight中授权HTTP适配器 [英] Authorizing HTTP Adapter in IBM Worklight

查看:91
本文介绍了在IBM Worklight中授权HTTP适配器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am struggling to get an HTTP Adapter request to a protected rss feed to execute properly. I have read a ton of IBM's documentation, as well as chasing dead links to moved or "under maintenance" IBM pages. Unfortunately, none of the examples I have found show how to authorize this request.

为了这个例子,我试图从Connections安装中访问rss feed在IBM Greenhouse Environment中。

For the sake of this example, I am trying to access an rss feed from the Connections installation in the IBM Greenhouse Environment.

适配器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>

适配器.js:

function getFeed() {
    var input = {
        method : 'get',
        returnedContentType : 'xml',
        path : 'connections/opensocial/basic/rest/activitystreams/@me/@all/@all?    rollup=true&format=atom'
    };
    return WL.Server.invokeHttp(input);
}

如何传递访问此Feed所需的凭据?

How can I pass the credentials required to access this feed?

谢谢!

推荐答案

您可以将身份验证机制指定为适配器XML的一部分文件。文档在这里: HTTP适配器的Authentication元素

You can specify the authentication mechanism as part of the adapter XML file. Documentation is here: The Authentication element of the HTTP adapter.

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

I don't have an instance of Worklight Studio in front of me at the moment to check but I would imagine that there is a design view of the adapter XML or some auto completion features to help fill how the details should be specified in the <authentication> block.

示例:

<?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>

这篇关于在IBM Worklight中授权HTTP适配器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆