编程语言
首页 > 编程语言> > nodejs koa 中 koa-jwt 传参数 无需验证的接口写法

nodejs koa 中 koa-jwt 传参数 无需验证的接口写法

作者:互联网

  _initializeJwt (koa) {
    let publicKey = fs.readFileSync('src/configurations/rsaKeys/jwtRS256.key.pub', 'utf8')
    const jwtMiddleware = jwt({ cookie: 'jwt', secret: publicKey })
      .unless({
        path: ['/sessions', '/wepay/notification', '/androidVersion', '/send_cellphone_key', '/dataPort', '/send_program_message', '/send_tour_guide_message', '/refund/notification', '/wepay/enterprise_payment', '/onelink_tour_guide_schedule', '/attractions', '/export_consumables', '/shuffling_figure', '/online_guides', '/evaluation', /\/tour_guides\/.+\/create_tour_order/, /\/tour_guides\/.+\/work_order\/.+\/update_slave_device/, /\/tour_guides\/.+\/work_order\/.+\/update_slave_device/, '/meeting/attendance/append']
      })
    koa.use(jwtMiddleware)
    return koa
  }

标签:.+,nodejs,koa,jwt,send,order,tour,guides
来源: https://blog.csdn.net/Tirst_/article/details/111277521