Closed ArnaudTA closed 2 months ago
Hi, thanks for your PR.
Could you add the document on the Configuration section in READMD.md
? and add some test cases for it?
done but I cannot run test on my computer and I still don't know why, can you give a try to the CI ?
hey, I found the cause, since Task
is lazy Promise, you have to add ()
to execute it
please refer the code below (the second line from the bottom)
fastify.addHook('preValidation', (request: FastifyRequest, reply: FastifyReply, done) => {
pipe(
request,
bypassFn,
TO.match(
() => {
done()
},
(request) =>
pipe(
request,
filterGrantRoute,
O.chain(filterExcludedPattern),
O.match(
() => {
done()
},
(request) =>
pipe(
request,
getBearerTokenFromRequest,
O.match(
() => authenticationByGrant(request, reply, done),
(bearerToken) => authenticationByToken(request, reply, bearerToken, done)
)
)
)
)
)
)() // <----- Here!
})
thanks for your help fp-ts totally lost me
It works well now !
Update to v2.2.0, Thanks your PR !
As requested in #51 and cause I need it too.
Here is my proposal, a bypass function can be send in options, the function receive the request and return a boolean, if true prevent the authentication methods, if false let the flow goes as usual.
Let me know what you think before I start writing tests.