Skip to content

Commit

Permalink
Use user mapped from JWT for Auth
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon Sun committed Feb 11, 2020
1 parent 8e195ef commit 2dcafa3
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ export function handleParseHeaders(req, res, next) {
delete info.sessionToken;
}

if (req.userFromJWT) {
req.auth = new auth.Auth({
config: req.config,
installationId: info.installationId,
isMaster: false,
user: req.userFromJWT,
});
next();
return;
}

if (!info.sessionToken) {
req.auth = new auth.Auth({
config: req.config,
Expand Down

0 comments on commit 2dcafa3

Please sign in to comment.