feathersJS自定义认证

feathersJS custom authentication

我正在尝试使用 feathersJS 创建身份验证。当他们从一开始就手动创建服务时,我不在那里,这意味着他们没有使用命令“feathers generate service”,现在,一切正常。但现在他们要我对他们的登录实施身份验证,我在文档中看到了一些示例,我必须像这样 default.json 放入

"authentication": {
"entity": null,
"service": "users",
"secret": "fhaCVRbeGa0XDMcxRKcnTMz/Ti8=",
"authStrategies": [
  "jwt",
  "local"
],
"jwtOptions": {
  "header": {
    "typ": "access"
  },
  "audience": "https://yourdomain.com",
  "issuer": "feathers",
  "algorithm": "HS256",
  "expiresIn": "1d"
},
"local": {
  "usernameField": "userName",
  "passwordField": "password"
}

}

所以我的第一个问题是这个。我应该从哪里得到那个实体?那是名字吗?或者必须有一个文件存在吗? 谢谢

感谢您的帮助,我已经使用您的帮助解决了它,我还注意到我还没有包含 .hooks 文件,谢谢 像这样

  before: {
    all: [],
    find: [ authenticate('jwt') ],
    get: [ authenticate('jwt') ],
    create: [ hashPassword('password') ],
    update: [ hashPassword('password'),  authenticate('jwt') ],
    patch: [ hashPassword('password'),  authenticate('jwt') ],
    remove: [ authenticate('jwt') ],
  },