FIWARE 如何从 Wirecloud 小部件访问 KeyRock IdM 令牌

FIWARE how to access KeyRock IdM token from Wirecloud widget

在全局 Wirecloud 实例中,我有一个使用此处提到的 KeystoneAPI 的小部件: https://wirecloud.readthedocs.io/en/stable/development/object_storage_api/

到目前为止一切顺利。

但是现在我想转到 KeyRock 进行身份验证。我仍然想将令牌从我的 wirecloud 小部件传递到后端服务,例如也未连接到 KeyRock 的 Wilma PEP 代理。但是 KeystoneAPI 似乎与 Keystone 相关联(可能因此得名)。

是否有可从 Wirecloud 小部件访问的 KeyRockAPI?小部件如何获取用户登录时使用的 KeyRock OAuth2 令牌?我找不到任何关于此的文档。

WireCloud 不允许小部件和操作员读取分配给用户的 OAuth2 令牌,但它支持将令牌注入通过 WireCloud 代理的 HTTP 请求。这个注入是由几个HTTP控制的headers,这是一个例子:

MashupPlatform.http.makeRequest(url, {
    requestHeaders: {
        "X-FI-WARE-OAuth-Token": "true",
        "X-FI-WARE-OAuth-Header-Name": "X-Auth-Token"
    },
    ...
});

您可以在 FIWARE Academy course 中找到有关如何使用此功能的更多信息,更具体地说,在 3.1.8. Accessing third-party services using IdM tokens 部分中(考虑到该文档与您在评论中指出的相同,但采用 html 格式 ;)).

对其他问题的回答以评论形式表达:

  • Installed docker containers of KeyRock and Wirecloud, tried out the objectstorage demo widget, which failed to retrieve an authentication token. Traced the problem to %idm_token% not being filled in by the python code, presumably in plugins.py because it looks for an AUTHENTICATION_BACKEND of 'fiware' whereas the documentation states to include 'wirecloud.fiware.social_auth_backend.FIWAREOAuth2'.

    我建议您在 Whosebug 中创建一个新问题来解决这个问题。请提供有关您的配置的更多详细信息。

  • So my authentication token from wirecloud will be bound to that application? If so, the token is useless to my own application unless i can get a new token for it. Am i wrong here?

    是的,Mashup 门户是帐户门户中的应用程序编号 17,WireCloud 获得的 OAuth2 令牌已绑定到该应用程序。我无法预见该令牌是否对您的应用程序有用。此令牌可用于对用户进行身份验证,但 IdM 会根据绑定到令牌的应用程序限制返回的信息(例如角色)。因此,显然,这种集成并不完美,但我们缺少 IdM 的一些集成功能以使其更有用。