-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
Describe the problem you'd like to have solved
If I have an endpoint:
fastify.post("/foo", {
schema: {
security: [{Auth0: ["foo"]}]
},
preParsing: fastify.requireAuth({ scopes: ["foo"] })
})It would be nice if requireAuth could automatically extract the scopes from the schema, so I don't have to specify them in two places.
Describe the ideal solution
Maybe something like this:
fastify.post("/foo", {
schema: {
security: [{Auth0: ["foo"]}]
},
preParsing: fastify.requireAuth({ schema: [0, "Auth0"] })
})Maybe a global config to allow for just fastify.requireAuth()
Alternatives and current work-arounds
- Deal with the minor duplication
- Define the scopes in a const
Additional context
It's just a nice to have, not a big deal
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels