You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/web/docs/src/content/router/security/authorization.mdx
+24-16Lines changed: 24 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -220,22 +220,22 @@ As you can see, the second group is a superset of the first and third groups, so
220
220
221
221
The composition process automatically simplified the merged policy by removing redundant scope groups.
222
222
223
-
## Authorization Rules by GraphQL Type
223
+
### Usage on Interface Types
224
224
225
-
### Object Types
226
-
Auth directives can be applied at type and field levels. Requirements are combined using AND.
225
+
Auth directives **cannot be applied directly to interface definitions**. Instead, authorization rules are **inherited** from the concrete types that implement the interface. When you query an interface or its fields, the authorization check applies the combined policies from all implementing types using logical `AND`.
227
226
228
-
### Scalars and Enums
229
-
Can have auth directives applied. When returned in a field, combined with field-level requirements.
227
+
<Callout type="note">
228
+
Interface authorization is computed during composition of the supergraph schema.
229
+
</Callout>
230
230
231
-
### Interface Types
232
-
Auth directives on interfaces are **disallowed**. Instead, apply directives to concrete implementing types. The effective policy for an interface is the logical `AND` of all implementing types' policies.
231
+
Look at this example with an `Item` interface implemented by `Book` and `Video` types, each with its own authorization requirements:
In this example, when querying items through the `Item` interface, both the `Book` and `Video` type requirements must be satisfied.
260
+
261
+
### Fields with `@requires`
251
262
252
-
### Union Types
253
-
Auth directives on unions are **prohibited**. Apply directives to concrete member types instead. This aligns with federation rules and avoids ambiguity.
263
+
A field using `@requires` to access fields from another entity must define an authorization policy that is a **superset** of the policies on all required fields. This prevents bypassing security policies by accessing protected fields through other fields.
254
264
255
-
## Field-Level Dependencies (`@requires`)
256
265
257
-
A field using `@requires` to access fields from another entity must define an authorization policy that is a **superset** of the policies on all required fields. This prevents bypassing security policies through federated queries.
0 commit comments