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

Merge pull request #1227 from nphyatt/feat-auth-jwt-plugin

feat: allow apiJWTmiddleware to be managed by Auth plugin
This commit is contained in:
Juan Picado @jotadeveloper 2019-02-13 20:58:53 +01:00 committed by GitHub
commit 820405a7d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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