kkemple / graphql-auth

🔒 GraphQL authentication and authorization middleware
MIT License
278 stars 19 forks source link

Support wildcards #14

Closed mschipperheyn closed 5 years ago

mschipperheyn commented 5 years ago

Judging by the code, you need to explicitly specify all scopes. But e.g. admins usually have access to all scopes. Would be nice if you could specify shortcuts like that

const scopes = {
    ADMIN: ['*'],
    EDITOR: [
        'user:*',
        'todo:*'
    ],
    ENDUSER: [
        'user:view:self',
        'user:update:self',
        'user:create',
        'todo:*'
    ]
}
kkemple commented 5 years ago

want to give this a go? there isn't a lot of code in the project, and im happy to walk you through implementation details

mschipperheyn commented 5 years ago

Hey @kkemple sorry. We decided to drop this and stick to a role based authorization structure and I'm too slammed to pick this up on the side.

artgibson commented 5 years ago

@mschipperheyn to resolve this should be handled right here: https://github.com/kkemple/graphql-auth/blob/master/index.js#L22