我们是 FINISH 加速器的一部分,并且正在使用 fiware 提供的 docker 容器在我们自己的服务器上部署 Wirecloud 和 KeyRock。
我们设置了 KeyRock-IdM 并链接到 Wirecloud。我们正在尝试将登录用户令牌传递给一个 API,该 API 将数据返回给一个小部件。
我们在 github 代码中找到了有关“X-FI-WARE...”标头的文档,并编写了一个测试小部件(如下所示的 main.js)。当部署在 fiware labs 实例上时,它开箱即用。当使用 docker 容器部署在我们的本地安装上时,它会出现以下错误:“当前用户没有活动的 FIWARE 配置文件”。我搜索了 settings.py 文件,但不知道这个错误来自哪里。我有 DEBUG=True 但日志中没有显示任何内容。运行小部件的用户是通过 KeyRock IdM 登录的。
/*jshint globalstrict:true */
/*global MashupPlatform, ObjectStorageAPI, StyledElements*/
(function () {
"use strict";
var token_available = MashupPlatform.context.get('fiware_token_available');
var username = MashupPlatform.context.get('username');
alert(username + " has token?: " + token_available);
var url = MashupPlatform.prefs.get('keyRock_url');
var request = MashupPlatform.http.makeRequest(url, {
requestHeaders: {
"X-FI-WARE-OAuth-Token": "true",
"X-FI-WARE-OAuth-GET-Parameter": "access_token"
},
method: "GET",
onSuccess: function (response) {
alert("Success:" + JSON.stringify(response.responseText));
document.getElementById('response').textContent = response.responseText;
},
onFailure: function (response) {
alert("Failed:" + JSON.stringify(response.responseText));
},
onComplete: function () {
}
}
);
})();
我怎样才能找出问题所在?
从下面的评论中,更改了一个 python 脚本:编辑了 docker 容器中的 /usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py 文件,并将第 37 行从 raise ValidationError(error_msg) 替换为一个简单的加薪。
/var/log/apache2/error.log 的日志如下
[Fri May 06 07:12:33.745550 2016] [wsgi:error] [pid 13:tid 139955375367936] Internal Server Error: /cdp/https/account.lab.fiware.org/user
[Fri May 06 07:12:33.745580 2016] [wsgi:error] [pid 13:tid 139955375367936] Traceback (most recent call last):
[Fri May 06 07:12:33.745584 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/proxy/views.py", line 234, in proxy_request
[Fri May 06 07:12:33.745587 2016] [wsgi:error] [pid 13:tid 139955375367936] response = WIRECLOUD_PROXY.do_request(request, url, request_method, workspace)
[Fri May 06 07:12:33.745589 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/proxy/views.py", line 144, in do_request
[Fri May 06 07:12:33.745592 2016] [wsgi:error] [pid 13:tid 139955375367936] processor.process_request(request_data)
[Fri May 06 07:12:33.745594 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py", line 59, in process_request
[Fri May 06 07:12:33.745597 2016] [wsgi:error] [pid 13:tid 139955375367936] token = get_access_token(request['user'], _('Current user has not an active FIWARE profile'))
[Fri May 06 07:12:33.745599 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/wirecloud/fiware/proxy.py", line 33, in get_access_token
[Fri May 06 07:12:33.745602 2016] [wsgi:error] [pid 13:tid 139955375367936] if oauth_info.access_token is None:
[Fri May 06 07:12:33.745604 2016] [wsgi:error] [pid 13:tid 139955375367936] File "/usr/local/lib/python2.7/site-packages/social/storage/base.py", line 41, in access_token
[Fri May 06 07:12:33.745615 2016] [wsgi:error] [pid 13:tid 139955375367936] return self.extra_data.get('access_token')
[Fri May 06 07:12:33.745618 2016] [wsgi:error] [pid 13:tid 139955375367936] AttributeError: 'unicode' object has no attribute 'get'