简体   繁体   English

使用Keystone进行身份验证后,Cosmos-gui应用程序崩溃

[英]Cosmos-gui application crashes after authentication with keystone

I have a problem. 我有个问题。 My cosmos gui application crashes after trying to authorize with keystone. 尝试使用Keystone授权后,我的cosmos gui应用程序崩溃。 Horizon application is running on https://192.168.4.33:443 , while cosmos-gui is running on http://192.168.4.180:81 . Horizo​​n应用程序在https://192.168.4.33:443上运行,而cosmos-gui在http://192.168.4.180:81上运行。 My gui config file looks like this: 我的gui配置文件如下所示:

"oauth2": {
"idmURL": "https://192.168.4.33",
"client_id": "***********************************",
"client_secret": "*********************************",
"callbackURL": "http://192.168.4.180:81/auth",
"response_type": "code"

}, },

and inside horizon i registered application Cosmos Big data with parameters: 在地平线上,我注册了应用程序Cosmos大数据,其参数为:

Description
Cosmos Big data

URL
https://192.168.4.33

Callback URL
http://192.168.4.180:81/auth

So afterwards i start cosmos-gui application and after clicking on login it redirects me to this url: 因此,之后我启动了cosmos-gui应用程序,并在单击登录后将其重定向到该URL:

https://192.168.4.33/oauth2/authorize/?response_type=code&client_id=0434fdf60897479588c3c31cfc957b6d&state=xyz&redirect_uri=http://192.168.4.180:81/auth

And that is ok.But then, when i click on button authorize it leads me to this url: 没关系。但是,当我单击按钮授权时,它将带我到这个网址:

http://192.168.4.180:81/auth?state=xyz&code=NVfyZUov1KuQ8yTw498oItHgYC2l9Z

and at that moment cosmos-gui application crashes and everything that i get from the log is this: 那时cosmos-gui应用程序崩溃了,我从日志中得到的一切都是这样:

/home/cosmos-gui/fiware-cosmos/cosmos-gui/src/app.js:138
    req.session.access_token = results.access_token;
                                      ^
TypeError: Cannot read property 'access_token' of undefined
at /home/cosmos-gui/fiware-cosmos/cosmos-gui/src/app.js:138:43
at /home/cosmos-gui/fiware-cosmos/cosmos-gui/src/oauth2.js:168:22
at ClientRequest.<anonymous> (/home/cosmos-gui/fiware-cosmos/cosmos-  gui/src/oauth2.js:140:9)
at ClientRequest.emit (events.js:95:17)
at CleartextStream.socketErrorListener (http.js:1548:9)
at CleartextStream.emit (events.js:95:17)
at SecurePair.<anonymous> (tls.js:1400:19)
at SecurePair.emit (events.js:92:17)
at SecurePair.maybeInitFinished (tls.js:980:10)
at CleartextStream.read [as _read] (tls.js:472:13)

On the side of keystone everything looks ok.This is from keystones log: 在梯形校正方面,一切看起来都不错,这来自梯形校正日志:

2015-08-24 16:34:02.604 27693 INFO keystone.contrib.oauth2.controllers [-] OAUTH2: Created Authorization Code to consumer 0434fdf60897479588c3c31cfc957b6d                 for user idm with scope [u'all_info']. Redirecting to http://192.168.4.180:81/auth?state=xyz&code=NVfyZUov1KuQ8yTw498oItHgYC2l9Z
2015-08-24 16:34:02.606 27693 INFO eventlet.wsgi.server [-] 127.0.0.1 - -   [24/Aug/2015 16:34:02] "POST /v3/OS-OAUTH2/authorize HTTP/1.1" 302 208 0.121336

After a bit of debugging and printing arguments that were going into the app.get('/auth', function(req, res) 经过一些调试和打印进入app.get('/ auth',function(req,res)的参数

i found this Error: DEPTH_ZERO_SELF_SIGNED_CERT 我发现此错误:DEPTH_ZERO_SELF_SIGNED_CERT

It seems it doesn't recognize self signed certificates as valid. 似乎无法识别自签名证书为有效证书。 Anyway as first line in file: 无论如何作为文件的第一行:

cosmos-gui/src/app.js i added 我添加了cosmos-gui / src / app.js

process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';

and now it is working. 现在它正在工作。

When you authorize the Cosmos app in Keystone, the callback URL is called and this piece of software is executed: 当您在Keystone中授权Cosmos应用程序时,将调用回调URL并执行以下软件:

// Handles requests from IDM with the access code

app.get('/auth', function(req, res) {
    // Using the access code goes again to the IDM to obtain the access_token
    oa.getOAuthAccessToken(req.query.code, function (e, results){
    // Stores the access_token in a session cookie
        req.session.access_token = results.access_token;
        res.redirect('/');
    });
});

Ie Keystone calls the callback with an access code (a soft piece of security) that can be used to retrieve the final access token (a hard security element). 即Keystone用访问代码(一种安全的软件)调用回调,该代码可用于检索最终的访问令牌(一种安全的硬件)。

It seems your Keystone is generating the access code but it is not returning the access token when asked for it. 您的Keystone似乎正在生成访问代码,但在询问时未返回访问令牌。 Can you check the Keystone logs in order to find the access token request? 您可以检查Keystone日志以查找访问令牌请求吗? May you print any error returned by this call? 您可以打印此呼叫返回的任何错误吗?

oa.getOAuthAccessToken(req.query.code, function (e, results)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM