Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions lib/policies/jwt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ module.exports = {
type: 'boolean',
default: true,
description: 'Value istructing the gateway whether verify the sub against the internal SOC'
},
algorithms: {
type: 'array',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should probably specify the items to be a string and then enum the possible choice. JWT has a fixed set of algorithms

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense, I just pushed up a change to reflect that. I wasn't 100% sure about the syntax so let me know if I need to modify it at all.

items: { type: 'string', enum: ['HS256', 'HS384', 'HS512', 'RS256', 'RS384', 'RS512'] },
description: 'If defined, limits valid jwts to specified algorithms'
}
},
required: ['jwtExtractor', 'checkCredentialExistence'],
Expand Down
3 changes: 2 additions & 1 deletion lib/policies/jwt/jwt.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ module.exports = function (params) {
secretOrKey,
jwtFromRequest: extractor,
audience: params.audience,
issuer: params.issuer
issuer: params.issuer,
algorithms: params.algorithms
}, (jwtPayload, done) => {
if (!jwtPayload) {
return done(null, false);
Expand Down