Skip to content

Commit 381f006

Browse files
committed
some adjustments, some answered questions
1 parent 5ddefe4 commit 381f006

File tree

1 file changed

+5
-15
lines changed

1 file changed

+5
-15
lines changed

modules/ROOT/pages/security/configuration.adoc

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,9 @@ The Neo4j GraphQL Library uses JSON Web Token (JWT) authentication.
55
JWTs are tokens containing claims or statements about the user or client making the request.
66
These claims can include information such as the user's ID or roles.
77

8-
When a user or client logs in to the API, the API generates a JWT and returns it to the client.
9-
The client then includes the JWT with each subsequent request to the API.
8+
A JWT can be obtained from an authentication service and is then included in an API request.
109
The API verifies the JWT and returns the requested data if the JWT is valid.
1110

12-
// ^ is this paragraph accurate?
13-
1411
== Instantiation
1512

1613
The Neo4j GraphQL Library can accept two types of JWTs:
@@ -21,7 +18,6 @@ The Neo4j GraphQL Library can accept two types of JWTs:
2118
=== Encoded JWTs
2219

2320
To use encoded JWTs, the library must to be configured with a key to decode and verify the tokens.
24-
2521
The following code block uses Apollo Server, extracts the `Authorization` header from the request and puts it in the appropriate context field:
2622

2723
[source, typescript, indent=0]
@@ -46,8 +42,6 @@ Optionally, if a custom decoding mechanism is required, that same header can be
4642

4743
To configure the library with a symmetric secret (e.g. "secret"), the following instantiation is required:
4844

49-
// ^ What is a symmetric secret? What is its purpose?
50-
5145
[source, typescript, indent=0]
5246
----
5347
new Neo4jGraphQL({
@@ -62,9 +56,7 @@ new Neo4jGraphQL({
6256

6357
==== JWKS endpoint
6458

65-
To configure the library to verify tokens against a JWKS endpoint, for example "https://www.myapplication.com/.well-known/jwks.json", the following instantiation is required:
66-
67-
// ^ What is the purpose?
59+
To configure the library to verify tokens against a JSON Web Key Set (JWKS) endpoint, for example "https://www.example.com/.well-known/jwks.json", the following instantiation is required:
6860

6961
[source, typescript, indent=0]
7062
----
@@ -82,7 +74,7 @@ new Neo4jGraphQL({
8274

8375
==== Passing in encoded JWTs
8476

85-
// This was at the end of the file, I thought it could be moved here instead. What about decoded JWTs?
77+
// What about decoded JWTs?
8678

8779
To pass in an encoded JWT, use the token field of the context.
8880
When using Apollo Server, extract the authorization header into the token property of the context:
@@ -153,7 +145,7 @@ You can use any name as long as it is decorated with the `@jwt` directive.
153145

154146
=== The `@jwtClaim` directive
155147

156-
A `roles` claim is not necessarily located at the JWT payload root, but can instead be in a nested location, for example:
148+
A `roles` claim is not necessarily located at the JWT payload root, but can instead be in a nested location, for example under `myApplication`:
157149

158150
[source, json, indent=0]
159151
----
@@ -165,8 +157,6 @@ A `roles` claim is not necessarily located at the JWT payload root, but can inst
165157
}
166158
----
167159

168-
// ^ why is this a nested location? can we show the nesting?
169-
170160
In this case, use the `@jwtClaim` directive:
171161

172162
[source, graphql, indent=0]
@@ -199,6 +189,6 @@ type JWT @jwt {
199189

200190
[NOTE]
201191
====
202-
This way of escaping is necessary to escape twice: once for GraphQL and once for `dot-prop`, which is used under the hood to resolve the path.
192+
The `path` must be escaped twice: once for GraphQL and once for `dot-prop`, which is used under the hood to resolve the path.
203193
====
204194

0 commit comments

Comments
 (0)