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