Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 1411739

Browse files
authored
Merge pull request #139 from topcoder-platform/fix-jwt-joi-validation
Allow unknown properties on the JWT
2 parents b091f99 + a1238cc commit 1411739

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/app.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,11 @@ _.forEach(routes, (verbs, path) => {
6363
if (!req.authUser) {
6464
return next(new errors.UnauthorizedError('Authorization failed.'));
6565
}
66-
req.currentUser = req.authUser;
66+
67+
req.currentUser = {
68+
handle: _.get(req, 'authUser.handle', '').toLowerCase(),
69+
roles: _.get(req, 'authUser.roles', [])
70+
};
6771

6872
return next();
6973
});

src/services/ProjectService.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const Project = models.Project;
2828
const currentUserSchema = Joi.object().keys({
2929
handle: Joi.string().required(),
3030
roles: Joi.array().required(),
31-
});
31+
}).unknown(true);
3232
const projectSchema = {
3333
project: {
3434
id: Joi.string().required(),

0 commit comments

Comments
 (0)