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:
commit
820405a7d7
1 changed files with 8 additions and 0 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Reference in a new issue