谁能通过 PeP 代理解释 Context Broker 的用法?
Can anyone explain the usage of Context Broker via PeP proxy?
我已经在我的机器上安装了 orion Context Broker 和 pep 代理。我的目标是 keyRock 的全局实例和 AuthZforce 来验证上下文代理。
这是我的 config.js:
var config = {};
config.pep_port = 1307;
// 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.account_host = 'https://account.lab.fiware.org';
config.keystone_host = 'cloud.lab.fiware.org';
config.keystone_port = 4731;
config.app_host = 'localhost';
config.app_port = '1026';
config.username = '<my fiware lab username>';
config.password = '<my fiware lab pass>';
// in seconds
config.chache_time = 300;
// if enabled PEP checks permissions with AuthZForce GE.
// only compatible with oauth2 tokens engine
config.azf = {
enabled: false,
host: 'auth.lab.fiware.org',
port: 6019,
path: '/authzforce/domains/d698df7f-ffd4-11e4-a09d-ed06f24e1e78/pdp'
};
// list of paths that will not check authentication/authorization
// example: ['/public/*', '/static/css/']
config.public_paths = [];
// options: oauth2/keystone
config.tokens_engine = 'oauth2';
config.magic_key = undefined;
module.exports = config;
当我node server.js
我成功得到:
Starting PEP proxy in port 1307. Keystone authentication ...
Success authenticating PEP proxy. Proxy Auth-token: e2189bdc1a8b4aae9280b0fd5a6ae8a0
在此之后 installation and administration guide 我执行了以下命令:
curl --header "X-Auth-Token:e2189bdc1a8b4aae9280b0fd5a6ae8a0" http://localhost:1307
从那里我收到这条消息:
[TOKEN] Checking token with IDM...
User access-token not authorized
我在这里很茫然,不知道如何通过这三个中介访问上下文代理?
我应该向谁索取令牌?
我什至不知道我是否在问正确的问题。所有这一切的目的是确保对上下文代理的访问。
编辑 1
设置auth-token.sh后,出现如下错误:
<orionError>
<code>400</code>
<reasonPhrase>Bad Request</reasonPhrase>
<details>service not found</details>
</orionError>
节点 server.js 报告:
Starting PEP proxy in port 1307. Keystone authentication ...
Success authenticating PEP proxy. Proxy Auth-token: b90604bc94134c1a81414e97a23196f3
[TOKEN] Checking token with IDM...
[ROOT] Access-token OK. Redirecting to app...
之前的命令:sh auth-token.sh <username> <pass>
给了我:
X-Auth-Token for '<my email on fiware lab>': OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc
然后我只是 curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307
这给了我前面提到的错误。
PEP 代理启动屏幕中显示的令牌不是您需要在 PEP 代理上进行身份验证的令牌。请查看此处的说明:。
简单的方法如下:
将 CLIENT_ID 和 CLIENT_SECRET 替换为您从 FIWARE 实验室获得的那些。也替换 https://idm/oauth2/token with https://account.lab.fiware.org/oauth2/token 然后只是 运行:
sh auth-token.sh <user-email> <password>
该脚本将向您显示您所使用的用户帐户的授权令牌。您可以 运行 以下内容来访问 Orion Context Broker:
curl --header "X-Auth-Token: <AUTH-TOKEN-DISPLAYED>" http://localhost:1307
您现在应该从 orion 收到正确的响应,根据您的配置,它应该 运行 在端口 1026 上。
还要确保您已在 FIWARE 实验室中正确配置重定向 URL。
@geissler 的回答是正确的。关于 Edit 1,这不是 PEP、Authzforce 或 KeyRock 返回的错误,而是关于 Orion Context Broker 使用的错误。
正在做
curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307
您没有查询任何操作,这就是您收到此错误的原因。请查看 Orion User and Programmers Guide 了解如何使用 Orion Context Broker。
对于端到端测试,您始终可以通过以下方式查询 Orion 以检索版本:
curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307/version
所以如果你得到它,你将正确访问受保护的猎户座。
我已经在我的机器上安装了 orion Context Broker 和 pep 代理。我的目标是 keyRock 的全局实例和 AuthZforce 来验证上下文代理。
这是我的 config.js:
var config = {};
config.pep_port = 1307;
// 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.account_host = 'https://account.lab.fiware.org';
config.keystone_host = 'cloud.lab.fiware.org';
config.keystone_port = 4731;
config.app_host = 'localhost';
config.app_port = '1026';
config.username = '<my fiware lab username>';
config.password = '<my fiware lab pass>';
// in seconds
config.chache_time = 300;
// if enabled PEP checks permissions with AuthZForce GE.
// only compatible with oauth2 tokens engine
config.azf = {
enabled: false,
host: 'auth.lab.fiware.org',
port: 6019,
path: '/authzforce/domains/d698df7f-ffd4-11e4-a09d-ed06f24e1e78/pdp'
};
// list of paths that will not check authentication/authorization
// example: ['/public/*', '/static/css/']
config.public_paths = [];
// options: oauth2/keystone
config.tokens_engine = 'oauth2';
config.magic_key = undefined;
module.exports = config;
当我node server.js
我成功得到:
Starting PEP proxy in port 1307. Keystone authentication ...
Success authenticating PEP proxy. Proxy Auth-token: e2189bdc1a8b4aae9280b0fd5a6ae8a0
在此之后 installation and administration guide 我执行了以下命令:
curl --header "X-Auth-Token:e2189bdc1a8b4aae9280b0fd5a6ae8a0" http://localhost:1307
从那里我收到这条消息:
[TOKEN] Checking token with IDM...
User access-token not authorized
我在这里很茫然,不知道如何通过这三个中介访问上下文代理?
我应该向谁索取令牌?
我什至不知道我是否在问正确的问题。所有这一切的目的是确保对上下文代理的访问。
编辑 1
设置auth-token.sh后,出现如下错误:
<orionError>
<code>400</code>
<reasonPhrase>Bad Request</reasonPhrase>
<details>service not found</details>
</orionError>
节点 server.js 报告:
Starting PEP proxy in port 1307. Keystone authentication ...
Success authenticating PEP proxy. Proxy Auth-token: b90604bc94134c1a81414e97a23196f3
[TOKEN] Checking token with IDM...
[ROOT] Access-token OK. Redirecting to app...
之前的命令:sh auth-token.sh <username> <pass>
给了我:
X-Auth-Token for '<my email on fiware lab>': OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc
然后我只是 curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307
这给了我前面提到的错误。
PEP 代理启动屏幕中显示的令牌不是您需要在 PEP 代理上进行身份验证的令牌。请查看此处的说明:
简单的方法如下:
将 CLIENT_ID 和 CLIENT_SECRET 替换为您从 FIWARE 实验室获得的那些。也替换 https://idm/oauth2/token with https://account.lab.fiware.org/oauth2/token 然后只是 运行:
sh auth-token.sh <user-email> <password>
该脚本将向您显示您所使用的用户帐户的授权令牌。您可以 运行 以下内容来访问 Orion Context Broker:
curl --header "X-Auth-Token: <AUTH-TOKEN-DISPLAYED>" http://localhost:1307
您现在应该从 orion 收到正确的响应,根据您的配置,它应该 运行 在端口 1026 上。 还要确保您已在 FIWARE 实验室中正确配置重定向 URL。
@geissler 的回答是正确的。关于 Edit 1,这不是 PEP、Authzforce 或 KeyRock 返回的错误,而是关于 Orion Context Broker 使用的错误。
正在做
curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307
您没有查询任何操作,这就是您收到此错误的原因。请查看 Orion User and Programmers Guide 了解如何使用 Orion Context Broker。
对于端到端测试,您始终可以通过以下方式查询 Orion 以检索版本:
curl --header "X-Auth-Token:OxFTGtMM6ckBa7FQCUmwvvhj6GQYFc" http://localhost:1307/version
所以如果你得到它,你将正确访问受保护的猎户座。