Skip to content

AuthGuardian support for adding ApolloServer roles directly #43

@sgrove

Description

@sgrove

We've added an effect specifically for our onegraph-apollo-server-auth library
today, where you can add a role directly in AuthGuardian. It was possible
before, but only with the In the json add to the list at path effect, which
was less explicit.

Now for example if you want to only allow someone to have moderator access to
your Apollo Server GraphQL server if they're a member of your GitHub
organization, you can write the following rules:

When this user on GitHub is member of organization named "OneGraph"

Then On apollo server add roles [moderator]

And our JWT will generated appropriately:

{
  "iss": "OneGraph",
  "aud": "https://serve.onegraph.com/dashboard/app/00000000-0000-0000-0000-000000000000",
  "iat": 1579589770,
  "exp": 1579676170,
  "user": {
    "roles": [
      "moderator"
    ]
  }
}

See the OneGraph Apollo Server Auth
Example
for
more info on how to use AuthGuardian to secure your Apollo Server GraphQL
server!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions