-
Notifications
You must be signed in to change notification settings - Fork 254
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce @authenticated
directive in composition
#2644
Conversation
🦋 Changeset detectedLatest commit: 70b695d The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
✅ Deploy Preview for apollo-federation-docs canceled.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. |
250504d
to
1dccf3e
Compare
430f425
to
1b1201b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left 2 test related comments but the patch lgtm so +1 (I'll still be happy if you fix my 2 test comments, but no need to re-review after that :)).
500769d
to
73b61ab
Compare
48bd9c5
to
b12d720
Compare
b12d720
to
b3c7dfb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Introduce the new `@policy` scope for composition > Note that this directive will only be _fully_ supported by the Apollo Router as a GraphOS Enterprise feature at runtime. Also note that _composition_ of valid `@policy` directive applications will succeed, but the resulting supergraph will not be _executable_ by the Gateway or an Apollo Router which doesn't have the GraphOS Enterprise entitlement. Users may now compose `@policy` applications from their subgraphs into a supergraph. The directive is defined as follows: ```graphql scalar federation__Policy directive @Policy(policies: [[federation__Policy!]!]!) on | FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM ``` The `Policy` scalar is effectively a `String`, similar to the `FieldSet` type. In order to compose your `@policy` usages, you must update your subgraph's federation spec version to v2.6 and add the `@policy` import to your existing imports like so: ```graphql @link(url: "https://specs.apollo.dev/federation/v2.6", import: [..., "@Policy"]) ``` For additional context, this PR effectively follows the pattern implemented by apollographql#2644 --------- Co-authored-by: Dariusz Kuc <9501705+dariuszkuc@users.noreply.github.com> Co-authored-by: Geoffroy Couprie <apollo@geoffroycouprie.com> Co-authored-by: Trevor Scheer <trevor.scheer@gmail.com>
This PR introduces the new
@authenticated
directive for compositionWith this change, users can now compose
@authenticated
applications from their subgraphs into a supergraph. This addition will support a future version of Apollo Router that enables authenticated access to specific types and fields via directive applications.Since the implementation of
@authenticated
is strictly a composition and execution concern, there's no change to the query planner with this work. The execution work is well under way in Apollo Router (and won't be built at all for Gateway). So as far as this repo is concerned, only composition is concerned with@authenticated
.TODO:
@requires
an@authenticated
field (or open follow up issue for this improvement) Opened@authenticated
and@requiresScopes
composition hints #2670