身份验证中基于节点红色用户的数据

时间:2019-06-09 17:41:27

标签: node.js node-red

使用这样的自定义登录时,是否可以添加基于用户的数据?我正在使用自定义身份验证模块。像这个例子:

 module.exports = {
   type: "credentials",
   authenticate: function(username,password) {
       return new Promise(function(resolve) {
           // Do whatever work is needed to validate the username/password
           // combination.
           if (valid) {
               // Resolve with the user object. Equivalent to having
               // called users(username);
               var user = { username: "admin", permissions: "*", customData: 'data' };
               resolve(user);
           } else {
               // Resolve with null to indicate the username/password pair
               // were not valid.
               resolve(null);
           }
       });
   },
}

我想向用户模型添加令牌。但是看起来用户模型删除了其他对象参数。

0 个答案:

没有答案