This repository is an exploration of the GraphQL network request process flow as it relates to determining the auth context and supplying it to downstream resolvers.
Please see scope and observations for a detailed narrative.
- Node
- Rover CLI * Optional. Used if you want to make changes to the GQL schema and update the gateway's super-graph.
Clone the repo locally. Then, within your terminal change the directory to gql-auth-proto
and run:
npm install
To run all services, within the project directory in the terminal:
npm start
Simple server with a single endpoint listening for POST requests.
GraphQL server with a straightforward schema and implementation.
Dependency: Fibonacci Sequence
Exposes GQL server as a subgraph. Please note that gateway implementation and configuration are purposefully made simple without introducing additional subgraphs to minimize scope and retain the focus on the request process flow investigation.
Dependency: GQL server
With the services running, you can use Apollo studio to send queries to either GQL server or GQL gateway.
You must supply the Authorization
header in order to authenticate and authorize requests.
In order to simulate an authorized user making requests, you can use the following:
purpose | |
---|---|
Authorization : none |
simulates authenticated user without rights to view any data |
Authorization : limited |
simulates user with rights to view a subset of available data |
Authorization : super |
simulates user with full data read permissions |
Please see the auth directory to understand more.
Each service logs color coded request processing events to the console. This mechanism is used to demonstrate the execution flow and parameters supplied to invoked functions within the execution sequence.