Skip to content

Commit f6bb9eb

Browse files
committed
ci: added changeset file for recent fixes, update knope
1 parent 501a48b commit f6bb9eb

3 files changed

+53
-1
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
router: patch
3+
---
4+
5+
# Internal refactor that prevents the need to create some structs (`ClientRequestDetails`) twice. This change also eliminates the need to have clones
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
---
2+
executor: patch
3+
router: patch
4+
---
5+
6+
Improve the implementation of jwt plugin and expose it to expressions.
7+
8+
The following properties are available in the request object exposed to VRL expressions:
9+
- `request.jwt` will always be an object
10+
- `request.jwt.authenticated` with value of true or false
11+
- `request.jwt.prefix` can either be a string or null (if prefix is not used)
12+
- `request.jwt.token` can be string (when authenticated=true) or null (when authenticated=false)
13+
- `request.jwt.claims` will always be an array (either empty or with values), containing the full JWT token claims payload.
14+
- `request.jwt.scopes` will always be an array (either empty or with values), containing the scopes extracted from the claims
15+
16+
Here are examples on how to use the JWT properties in a VRL expression:
17+
18+
```yaml
19+
# Passes the user-id held in `.sub` claims of the token to the subgraph, or EMPTY
20+
headers:
21+
all:
22+
request:
23+
- insert:
24+
name: X-User-ID
25+
expression: |
26+
if .request.jwt.authenticated == true {
27+
.request.jwt.claims.sub
28+
} else {
29+
"EMPTY"
30+
}
31+
```
32+
33+
```yaml
34+
# Passes a custom header based on the status of the authentication and the status of the JWT scopes
35+
headers:
36+
subgraphs:
37+
accounts:
38+
request:
39+
- insert:
40+
name: X-Can-Read
41+
expression: |
42+
if .request.jwt.authenticated == true && includes!(.request.jwt.scopes, "read:accounts") {
43+
"Yes"
44+
} else {
45+
"No"
46+
}
47+
```

knope.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ name = "release"
3535
[[workflows.steps]]
3636
type = "Release"
3737

38-
# "document-change" pipeline that prepares the release and pushes a release PR
38+
# "document-change" / "changeset" pipeline that helps to create a changeset file during development
3939
[[workflows]]
4040
name = "document-change"
4141
[[workflows.steps]]

0 commit comments

Comments
 (0)