Skip to content

Commit 4202fda

Browse files
committed
cleanup
1 parent 819d747 commit 4202fda

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

protection/jwt-claims/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ from being executed by field visibility and access rules.
2323
Instead a field `Query.me` is exposed with no field arguments that invokes `Query.customer`
2424
with the customer identifier pulled from the `sub` claim in the request's JWT.
2525

26-
This is implemented using `@sequence` with the first step an intermediate field (`Query._myid`) that is annotated with `@value` using an ECMAScript.
26+
This is implemented using `@sequence` with the first step an intermediate field (`Query._myid`) that is annotated with `@value` using ECMAScript.
2727
This script has access to field arguments of its annotated field (in this case none) and JWT claims through `$jwt`.
2828
Thus it returns the `sub` claim which is then automatically mapped as a scalar value to the sole argument of
2929
the next step in the sequence (`Query.customer(id:)`).

protection/jwt-claims/api.graphql

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ type Customer {
55
}
66

77
type Query {
8+
"""
9+
Fetch customer by identifier.
10+
"""
811
customer(id: ID!): Customer
912
@dbquery(
1013
type: "postgresql"
@@ -13,6 +16,10 @@ type Query {
1316
configuration: "postgresql_config"
1417
)
1518

19+
"""
20+
Fetch my customer information.
21+
Customer identifier is pulled from the JWT subject claim.
22+
"""
1623
me: Customer @sequence(steps: [{ query: "_myid" }, { query: "customer" }])
1724

1825
"""

0 commit comments

Comments
 (0)