Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added algorithm option to jwt policy #999

Merged
merged 2 commits into from
Jul 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 4 additions & 0 deletions lib/policies/jwt/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ 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.

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