[英]Cosmos-gui application crashes after authentication with keystone
我有個問題。 嘗試使用Keystone授權后,我的cosmos gui應用程序崩潰。 Horizon應用程序在https://192.168.4.33:443上運行,而cosmos-gui在http://192.168.4.180:81上運行。 我的gui配置文件如下所示:
"oauth2": {
"idmURL": "https://192.168.4.33",
"client_id": "***********************************",
"client_secret": "*********************************",
"callbackURL": "http://192.168.4.180:81/auth",
"response_type": "code"
},
在地平線上,我注冊了應用程序Cosmos大數據,其參數為:
Description
Cosmos Big data
URL
https://192.168.4.33
Callback URL
http://192.168.4.180:81/auth
因此,之后我啟動了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
沒關系。但是,當我單擊按鈕授權時,它將帶我到這個網址:
http://192.168.4.180:81/auth?state=xyz&code=NVfyZUov1KuQ8yTw498oItHgYC2l9Z
那時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)
在梯形校正方面,一切看起來都不錯,這來自梯形校正日志:
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
經過一些調試和打印進入app.get('/ auth',function(req,res)的參數
我發現此錯誤:DEPTH_ZERO_SELF_SIGNED_CERT
似乎無法識別自簽名證書為有效證書。 無論如何作為文件的第一行:
我添加了cosmos-gui / src / app.js
process.env.NODE_TLS_REJECT_UNAUTHORIZED = '0';
現在它正在工作。
當您在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('/');
});
});
即Keystone用訪問代碼(一種安全的軟件)調用回調,該代碼可用於檢索最終的訪問令牌(一種安全的硬件)。
您的Keystone似乎正在生成訪問代碼,但在詢問時未返回訪問令牌。 您可以檢查Keystone日志以查找訪問令牌請求嗎? 您可以打印此呼叫返回的任何錯誤嗎?
oa.getOAuthAccessToken(req.query.code, function (e, results)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.