menu

Apollo

A community of developers, designers and others who love Apollo and GraphQL. 🚀

Channels
# All channels
view-forward
# General
view-forward
# Apollo Angular
view-forward
# Announcements
view-forward
# Apollo Android
view-forward
# Apollo Client
view-forward
# Apollo iOS
view-forward
# Apollo Link
view-forward
# Apollo Link Rest
view-forward
# Local State
view-forward
# Apollo Platform
view-forward
# Apollo Server
view-forward
# Apollo Tooling
view-forward
# Contributing
view-forward
# Docs
view-forward
# Events
view-forward
# GraphQL Tools
view-forward
# Jobs
view-forward
# Random
view-forward
# React Apollo
view-forward
# Showcase
view-forward
# Subscriptions
view-forward
# Testing
view-forward
# Vue Apollo
view-forward
Team

Sharing an @auth directive over multiple services

March 24, 2020 at 7:34am

Sharing an @auth directive over multiple services

March 24, 2020 at 7:34am
Hi, I am trying to implement RBAC in my federated Apollo stack. Normally I would use a (permission = 'module.submodule.action'). However the directives are not shared between the services so now each service would need to implement the same directive. This would not have been a problem when it was a directive like that doesn't use data that is not available inside the federated service. Sadly the needs to look up a user and its roles and (a lot of) permissions from my identity service. I hoped that when I defined the directive in the identity service they would also be available in the other services but that did not work. The system is also quite big so getting the permissions in the context of the gateway and sending it to the services using headers is a no go as they likely could exceed the character limit. I sometimes also just need to lock a attribute and sometimes the entire type
Do you guys know how I would achieve something like that? Perhaps it is possible for me to implement the directive in the gateway and just "type" it in the underlaying services (mimicking the , , , ... of /federation) but I have no idea how I would implement directives in the gateway itself.
No messages yet