Skip to content

add authenticating as a function#21

Open
hazeezet wants to merge 10 commits intopatrickpissurno:masterfrom
hazeezet:master
Open

add authenticating as a function#21
hazeezet wants to merge 10 commits intopatrickpissurno:masterfrom
hazeezet:master

Conversation

@hazeezet
Copy link

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);

@hazeezet
Copy link
Author

@patrickpissurno, please can you take a look.

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.

1 participant