apollo-universal-starter-kit
apollo-universal-starter-kit copied to clipboard
Modular Role Scope
I noticed the scope for graphql-auth
is currently nested under the user module. I thought it would be cool if different modules could declare their own scope and then compose them together.
Any thoughts on this? I'd be happy to get a PR going. Thanks!
That would be a nice addition. I remember we were talking about something like this in the gitter chat.
@mairh cool I'll do a search through there and take a crack at it.
You may look at what I have been doing on this branch with auth/scopes https://github.com/sysgears/apollo-universal-starter-kit/pull/562
config/auth.js
is a good outline of the auth system.
graphql-auth
has some limitations, I pulled the code into src/common/authValidation.js
The backend "withAuth" is joined by a "checkAuth" which uses the same permissioning format.
The setup should allow for many numbers of scope styles and verification. I have some concern about the way graphql-auth
and withAuth does it's validations. (It's basically a pairwise comparison between required scopes and provided scopes that replaces '' with '.' and then does a regex check. Seems that could go awry and be difficult to catch security bugs.
Still have to think about how validation works with context and object ownership...