moving to koa 2.0; + api
This commit is contained in:
1 parent
44724132c0
commit
0ffa403b60
17 files changed
+398
-339
No files matched your search
@@ -0,0 +1,14 @@
|
||||
import {checkAuth} from '../core/service';
|
||||
|
||||
export function ensureServiceAuth() {
|
||||
return async (ctx, next) => {
|
||||
let service = ctx.request.headers['x-service-name'];
|
||||
let token = ctx.request.headers['x-service-token'];
|
||||
|
||||
if (!checkAuth(service, token)) {
|
||||
ctx.status = 401;
|
||||
} else {
|
||||
await next();
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user