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

fix: Async key provider and errors should be resolved internally #335

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

NikitaIT
Copy link
Contributor

@NikitaIT NikitaIT commented Apr 2, 2024

False positive tests: test: Async key provider errors should be resolved internally

Fix & test fix: feat: Async key provider

Related issue: #334

Checklist

Copy link
Contributor Author

@NikitaIT NikitaIT left a comment

Choose a reason for hiding this comment

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

This PR seems to work, I use it as a patch in my code. So far no problems have been noticed. All comments in the review are left for ease of review. They are not open issues on my part, or my todo. Close them as you become familiar. Thank you

} else {
const verifyResult = verifier(token)
callback(null, verifyResult)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

verifyResult moved in order to support promise based result.

jwt.js Show resolved Hide resolved
jwt.js Show resolved Hide resolved
}
})
fastify.get('/', async function (request, reply) {
request.headers.jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.hQOxra1Zo9z61vCqe6_86kVfLqKI0WxDnkiJ_upW0sM'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hardcoded request.headers.jwt is for key=this secret reused from cache
Generated with https://jwt.io/

Copy link
Member

Choose a reason for hiding this comment

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

please generate this dynamically in code.

test/jwt-async.test.js Show resolved Hide resolved
@NikitaIT NikitaIT changed the title test: Async key provider and errors should be resolved internally fix: Async key provider and errors should be resolved internally Apr 3, 2024
})
fastify.get('/', async function (request, reply) {
request.headers.jwt =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
Copy link
Member

Choose a reason for hiding this comment

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

please generate this dynamically in code.

}
})
fastify.get('/', async function (request, reply) {
request.headers.jwt = 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.hQOxra1Zo9z61vCqe6_86kVfLqKI0WxDnkiJ_upW0sM'
Copy link
Member

Choose a reason for hiding this comment

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

please generate this dynamically in code.

test/jwt-async.test.js Show resolved Hide resolved
})
fastify.get('/', async function (request, reply) {
request.headers.jwt =
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c'
Copy link
Member

Choose a reason for hiding this comment

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

please generate this dynamically in code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants