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

add authenticating as a function #21

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

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