fastify / fastify-auth

Run multiple auth functions in Fastify
Other
341 stars 56 forks source link

feat: more flexible composited authenication #195

Closed shenxdtw closed 1 year ago

shenxdtw commented 1 year ago

According to the current version, only a default relationship of either all AND or all OR can be set.

If I want to configure the following verification relationship: [(verifyUserPassword and verifyLevel) or (verifyVIP)]

it cannot be configured.

This PR is intended to address more complex authorization scenarios in practice, including both AND and OR relationships.

I will treat it as a two-dimensional array where each element represents a verification method, and the second dimension of the array always has an AND relationship.

And it is backwards compatible with defaultRelation OR and AND.

Checklist

Fdawgs commented 1 year ago

Bruh, just update the same PR/branch, no need to keep creating and deleting PRs. :)