Skip to content

Commit

Permalink
feat: allow apiJWTmiddleware to be managed by Auth plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
nphyatt committed Feb 11, 2019
1 parent 10370c6 commit 049917a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,14 @@ class Auth implements IAuth {
}

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) => {
req.pause();

Expand Down

0 comments on commit 049917a

Please sign in to comment.