1

我想将 pep-proxy 与 idm 连接起来 .. 所以我从该链接安装 pep .. https://github.com/ging/fiware-pep-proxy从源代码构建它。那是我应该编辑的配置文件

// Credentials obtained when registering PEP Proxy in app_id in Account Portal
config.pep = {
    app_id: '',
    username: '',
    password: '',
    trusted_apps : []
}

我还想知道如何同时获取 app_id 和trusted_apps 参数,并且我也对app_id 的含义感到困惑,无论它是否是客户端ID。

这是我问题的第一部分。

当我将客户端 id 与应用程序 id 并输入我在 idm 上注册时获得的 pep 代理的用户名和密码时,我得到了 keystone 通信错误

当我通过在开头添加“http”来编辑 idm 主机参数时,我没有得到任何令牌并且我得到“令牌未定义”消息。此外,当我通过输入 idm 帐户来编辑用户名和密码时,每次我都会获得一个新令牌。所以我想知道构建fiware pep-proxy并使其与idm正确通信而没有问题的最佳方法。

然后我尝试按照 docker 文件中的安装命令进行操作。在使用这些命令构建 pep-proxy 时,我得到了一个新的配置文件,它是 fiware academia 的配置文件

在此处输入图像描述

这个配置文件与我处理的第一个不同。当我按照此视频中的步骤https://www.youtube.com/watch?v=dtKsjGbJ7Xc&index=10&list=PLARS-yIy9nOoBIOJS05Rpkvu1pZiNTgPT 并通过输入 pep-proxy 配置用户名和密码时,我收到了这个错误。

在此处输入图像描述

在 keystone 参数之前放置“http”如下

config.keystone_host = 'http://cloud.lab.fiware.org';

我收到了这条消息

在此处输入图像描述

但是将idm的用户名和密码放入配置中,如下所示

config.username = 'idm_user_mail;
config.password = 'password';

我总是得到一个新的令牌。

现在,我想知道让 pep-proxy 和 idm 一起工作的最佳方法,因为我仍在努力让它们正常通信。

编辑:我已经从这些链接部署了最新版本的 pep-proxy 和 idm。https://github.com/ging/fiware-pep-proxy,https://github.com/ging/fiware-idm。_ _ 我还配置了 pep-proxy 如下

```
// Set this var to undefined if you don't want the server to listen on HTTPS
config.https = {
    enabled: false,
    cert_file: 'cert/cert.crt',
    key_file: 'cert/key.key',
    port: 443
};

config.idm = {
        host: 'localhost',
        port: 3000,
        ssl: false
}

config.app = {
        host: 'www.google.com',
        port: '80',
        ssl: false // Use true if the app server listens in https
}


// Credentials obtained when registering PEP Proxy in app_id in Account Portal
config.pep = {
        app_id: 'XXXXXXXXX',
        username: 'XXXXXXXX',
        password: 'XXXXXXXX,
        trusted_apps : []
}

// in seconds
config.cache_time = 300;
```

并在启动 idm 和 pep-proxy 时,我得到一个令牌,如以下日志所示 32775470_524428264620979_7740486530111635456_n

这是 idm 的日志

32779988_524428297954309_4770390630587170816_n

当我通过使用提供的令牌发送请求来使用 idm 测试 pep-proxy 时,我从服务器得到一个空回复,如下所示 32764669_524428831287589_4228451219091226624_n

这些也是发送请求后 pep-proxy 的日志。

32856053_524428894620916_5143172278388785152_n

编辑:我想现在我的令牌没有成功创建,或者我正在使用已弃用的 API,因为我正在使用在 fiware academy 中提到的 Oauth2-client 来生成令牌 https://github.com/ging/oauth2-example-client?files= 1

并成功生成令牌,如图 并成功生成令牌,如图

当我单击获取用户信息时,当我尝试在 pep proxsy 中使用此令牌时出现相同的错误出现在 Oauth2-client 中并且客户端已停止  我尝试使用不同的方式来生成令牌以及如何使用此令牌我的意思是最少和描述如何与 idm 一起玩但没有找到它的文档的稳定版本,所以我在问如何创建一个有效的令牌如果有一个与 idm 的 leates 版本兼容的文档,请提及它,抱歉给您带来不便

更新:我已按照此文档“ https://www.slideshare.net/mobile/daltoncezane/integrating-fiware-orion-keyrock-and-wilma ”在 idm 和 pep 代理之间进行通信,特别是此代码以从中生成令牌idm 使用邮递员发送

POST to "http://idm_ip:8000/oauth2/token"
Payload:
grant_type=password&username=YOUR_USERNAME&password=YOUR_PASSWORD&cli
ent_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET

但无法生成令牌这是邮递员响应

DOCTYPE html> 错误

SyntaxError:意外的令牌


   在JSON.parse (<anonymous>)的位置 0 的 JSON 中
   createStrictSyntaxError

(/home/ubuntu/fiware-idm/node_modules/body-parser/lib/types/json.js:157:10)
   解析时 (/home/ubuntu/fiware-idm/node_modules/body-parser/lib/types/json.js:83:15)
   在 /home/ubuntu/fiware-idm/node_modules/body-parser/lib/read.js:121:18
   在调用回调 (/home/ubuntu/fiware-idm/node_modules/raw-body/index.js:224:16)
   完成时 (/home/ubuntu/fiware-idm/node_modules/raw-body/index.js:213:7)
   在 IncomingMessage.onEnd (/home/ubuntu/fiware-idm/node_modules/raw-body/index.js:273:7)
   在 emitNone (events.js:106:13)
   在 IncomingMessage.emit (events.js:208:7)
   在 endReadableNT (_stream_readable.js:1064:12)
   在 _combinedTickCallback (internal/process/next_tick.js:138:11)
   在 process._tickCallback (内部/进程/next_tick.js:180:9)

这是发送请求后的 idm 日志

POST /oauth2/token 400 1.679 ms - 1164                                       
SyntaxError: Unexpected token # in JSON at position 0                        
    at JSON.parse (<anonymous>)                                              
    at createStrictSyntaxError (/home/ubuntu/fiware-idm/node_modules/body-par
ser/lib/types/json.js:157:10)                                                
    at parse (/home/ubuntu/fiware-idm/node_modules/body-parser/lib/types/json
.js:83:15)                                                                   
    at /home/ubuntu/fiware-idm/node_modules/body-parser/lib/read.js:121:18   
    at invokeCallback (/home/ubuntu/fiware-idm/node_modules/raw-body/index.js
:224:16)                                                                     
    at done (/home/ubuntu/fiware-idm/node_modules/raw-body/index.js:213:7)   
    at IncomingMessage.onEnd (/home/ubuntu/fiware-idm/node_modules/raw-body/i
ndex.js:273:7)                                                               
    at emitNone (events.js:106:13)                                           
    at IncomingMessage.emit (events.js:208:7)                                
    at endReadableNT (_stream_readable.js:1064:12)                           
    at _combinedTickCallback (internal/process/next_tick.js:138:11)          
    at process._tickCallback (internal/process/next_tick.js:180:9)           

希望更加清晰,并且有解决方案

4

0 回答 0