0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

feat: allow apiJWTmiddleware to be managed by Auth plugin

This commit is contained in:
Nicholas Hyatt 2019-02-11 12:50:11 -06:00
parent 10370c6eeb
commit 049917a0a6

View file

@ -223,6 +223,14 @@ class Auth implements IAuth {
} }
apiJWTmiddleware() { apiJWTmiddleware() {
const plugins = this.plugins.slice(0);
const helpers = {buildAnonymousUser, authenticatedUser};
for (const plugin of plugins) {
if (plugin.apiJWTmiddleware) {
return plugin.apiJWTmiddleware(helpers);
}
}
return (req: $RequestExtend, res: $Response, _next: NextFunction) => { return (req: $RequestExtend, res: $Response, _next: NextFunction) => {
req.pause(); req.pause();