Open hazeezet opened 9 months ago
When this plugin is used, it only validate through a preHandler hook
fastify.requireAuthentication(fastify);
But in a use case where by you need to validate without using a hook. maybe you just want to validate a header or cookie or query
a good example is a graphql application whereby using hook does not really fit it, you need to validate at resolver level rather than at route level.
so using it as a function will be nice, just by passing request and reply instance instead of fastify instance
await fastify.requireAuthentication(request, reply);
@patrickpissurno, please can you take a look.
When this plugin is used, it only validate through a preHandler hook
But in a use case where by you need to validate without using a hook. maybe you just want to validate a header or cookie or query
a good example is a graphql application whereby using hook does not really fit it, you need to validate at resolver level rather than at route level.
so using it as a function will be nice, just by passing request and reply instance instead of fastify instance