我已经可以按照@zemirco在CouchDB with NodeJS authentication solution上发布的所有步骤进行安装,它可以正常工作,我可以“保护端点”,我的意思是:
router.get('/', utils.restrict(config), function(req, res) {
res.sendFile(path.join(__dirname, '../secure', 'form.html'));
});
它将我重定向到登录名,但是在我登录应用程序后崩溃并打印:
GET /kpi 302 5.312 ms - 84
cookie exists 363097153470459
GET /login?redirect=/kpi 304 235.362 ms - -
cookie exists 363097153470459
GET /stylesheets/style.css 304 2.864 ms - -
cookie exists 363097153470459
crypto.js:694
throw new TypeError(
^
TypeError: The "digest" argument is required and must not be undefined
at pbkdf2 (crypto.js:694:11)
at Object.exports.pbkdf2 (crypto.js:682:10)
at Object.exports.hash (/home/bitnami/nodeApps/monolitico/node_modules/couch-pwd/index.js:41:12)
at /home/bitnami/nodeApps/monolitico/node_modules/lockit-login/index.js:191:9
at /home/bitnami/nodeApps/monolitico/node_modules/lockit-couchdb-adapter/index.js:189:7
at Request._callback (/home/bitnami/nodeApps/monolitico/node_modules/lockit-couchdb-adapter/node_modules/nano/lib/nano.js:221:16)
at Request.self.callback (/home/bitnami/nodeApps/monolitico/node_modules/request/request.js:185:22)
at emitTwo (events.js:126:13)
at Request.emit (events.js:214:7)
at Request.<anonymous> (/home/bitnami/nodeApps/monolitico/node_modules/request/request.js:1161:10)
at emitOne (events.js:116:13)
at Request.emit (events.js:211:7)
at IncomingMessage.<anonymous> (/home/bitnami/nodeApps/monolitico/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:313:30)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
无论Cookie是否存在,您都可以看到它如何将我重定向到登录名,但登录成功后便会崩溃