egg plugin for HTTP basic and digest access authentication.
$ npm i egg-http-auth --save
// {app_root}/config/plugin.js
exports.httpAuth = {
enable: true,
package: 'egg-http-auth',
};
// {app_root}/config/config.default.js
exports.httpAuth = {
username: 'username',
password: 'password',
// match: '',
// which routes you want to ignore this middleware
// ignore: ''
// match: (ctx) {
// }
};
see config/config.default.js for more detail.
// for old version eggjs which does support match options
// {app_root}/config/config.default.js
exports.httpAuth = {
username: 'username',
password: 'password',
match: /^\/api\/v1\/backdoor/
};
Please open an issue here.