Skip to content

Commit 4367726

Browse files
chore(release): router crates and artifacts
1 parent 89fa5cd commit 4367726

File tree

4 files changed

+51
-48
lines changed

4 files changed

+51
-48
lines changed

.changeset/authz-directives.md

Lines changed: 0 additions & 46 deletions
This file was deleted.

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bin/router/CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,55 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
116116
### Other
117117

118118
- *(deps)* update release-plz/action action to v0.5.113 ([#389](https://github.com/graphql-hive/router/pull/389))
119+
## 0.0.20 (2025-11-21)
120+
121+
### Features
122+
123+
- support authenticated and requiresScopes directives (#538)
124+
125+
#### Directive-Based Authorization
126+
127+
Introducing directive-based authorization. This allows you to enforce fine-grained access control directly from your subgraph schemas using the `@authenticated` and `@requiresScopes` directives.
128+
129+
This new authorization layer runs before the query planner, ensuring that unauthorized requests are handled efficiently without reaching your subgraphs.
130+
131+
#### Configuration
132+
133+
You can configure how the router handles unauthorized requests with two modes:
134+
135+
- **`filter`** (default): Silently removes any fields the user is not authorized to see from the query. The response will contain `null` for the removed fields and an error in the `errors` array.
136+
- **`reject`**: Rejects the entire GraphQL operation if it requests any field the user is not authorized to access.
137+
138+
To configure this, add the following to your `router.yaml` configuration file:
139+
140+
```yaml
141+
authentication:
142+
directives:
143+
unauthorized:
144+
# "filter" (default): Removes unauthorized fields from the query and returns errors.
145+
# "reject": Rejects the entire request if any unauthorized field is requested.
146+
mode: reject
147+
```
148+
149+
If this section is omitted, the router will use `filter` mode by default.
150+
151+
#### JWT Scope Requirements
152+
153+
When using the `@requiresScopes` directive, the router expects the user's granted scopes to be present in the JWT payload. The scopes should be in an array of strings or a string (scopes separated by space), within a claim named `scope`.
154+
155+
Here is an example of a JWT payload with the correct format:
156+
157+
```json
158+
{
159+
"sub": "user-123",
160+
"scope": [
161+
"read:products",
162+
"write:reviews"
163+
],
164+
"iat": 1516239022
165+
}
166+
```
167+
119168
## 0.0.19 (2025-11-19)
120169

121170
### Features

bin/router/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "hive-router"
3-
version = "0.0.19"
3+
version = "0.0.20"
44
edition = "2021"
55
description = "GraphQL router/gateway for Federation"
66
license = "MIT"

0 commit comments

Comments
 (0)