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
Describe the problem you'd like to have solved
If I have an endpoint:
It would be nice if
requireAuthcould 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:
Maybe a global config to allow for just
fastify.requireAuth()Alternatives and current work-arounds
Additional context
It's just a nice to have, not a big deal