Closed yakovenkodenis closed 7 months ago
So, this PR breaks my preHandler
:
// I expect [[f1 AND f2 AND Fn] OR [F3 AND F4 AND Fn]], { relation: 'or' }
fastify.auth(
[
[fastify.checkAuth('admins'), ...someOtherAdminChecks],
[fastify.checkAuth('clients'), ...someOtherClientChecks],
],
{ relation: 'or' }
)
It runs both paths even first path is passing. I'll try to find the issue in the changes.
This PR addresses Issue #216: Extending composite authentication to allow nesting auth arrays with both
and
andor
relations.If the
relation
(defaultRelation
) parameter isand
, then the relation inside sub-arrays will beor
. If therelation
(defaultRelation
) parameter isor
, then the relation inside sub-arrays will beand
.fastify.auth([f1, f2, [f3, f4]], { relation: 'or' })
f1 OR f2 OR (f3 AND f4)
fastify.auth([f1, f2, [f3, f4]], { relation: 'and' })
f1 AND f2 AND (f3 OR f4)
Checklist
npm run test
andnpm run benchmark