Skip to content

Commit a82c9a4

Browse files
demeyerthommvantellingen
authored andcommitted
feat: added prettier check in lint, ran formatter
1 parent c1312ad commit a82c9a4

File tree

8 files changed

+3739
-1562
lines changed

8 files changed

+3739
-1562
lines changed

README.md

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,43 +2,44 @@
22

33
[![npm](https://img.shields.io/npm/v/@labdigital/federated-token.svg)](https://www.npmjs.com/package/@labdigital/federated-token)
44

5-
65
This package provides support for using JWT tokens for clients and passing
76
that information to all federated services. The JWT token includes a JWE token
87
for sensitive information like the client specific access tokens of third party
98
systems.
109

1110
It provides three Apollo specific classes:
12-
- `GatewayAuthPlugin` - An Apollo plugin for the GraphQL gateway that verifies
13-
the signature of the token passed and decrypts the embedded JWE property. It
14-
stores the verified and decrypted token on the context as `federatedToken`.
1511

16-
- `FederatedGraphQLDataSource` - An Apollo GraphQL data source used in the
17-
GraphQL Gateway which passes the `federatedToken` from the context to the
18-
datasource (federated service) as `x-access-token` HTTP header.
12+
- `GatewayAuthPlugin` - An Apollo plugin for the GraphQL gateway that verifies
13+
the signature of the token passed and decrypts the embedded JWE property. It
14+
stores the verified and decrypted token on the context as `federatedToken`.
15+
16+
- `FederatedGraphQLDataSource` - An Apollo GraphQL data source used in the
17+
GraphQL Gateway which passes the `federatedToken` from the context to the
18+
datasource (federated service) as `x-access-token` HTTP header.
1919

20-
- `FederatedAuthPlugin` - An Apollo plugin for federated services that reads
21-
the token passed in the `x-access-token` header and stores it on the context
22-
as `federatedToken`.
20+
- `FederatedAuthPlugin` - An Apollo plugin for federated services that reads
21+
the token passed in the `x-access-token` header and stores it on the context
22+
as `federatedToken`.
2323

2424
When a federated services creates a new token (when non exist) it can also
2525
return a refresh token in the `x-refresh-token` header. The gateway will then
2626
encrypt all refresh tokens and encrypt them before passing them to the client
2727
as `x-refresh-token` header.
2828

29-
3029
# Token sources
30+
3131
Public tokens can be passed via either HTTP headers or cookies. For browser
3232
clients cookies are the preferred way since these are easiest to store safely in
3333
the browser using a combination of HTTP_ONLY cookies and non-HTTP_ONLY cookies.
3434

35-
3635
## Cookie Token Source
36+
3737
This token source is used for browser clients to safely store the token. It is
3838
implemented via 4 cookies:
39-
- `accessToken` - The JWT token
40-
- `tokenFingerprint` - A random string that is used to protect the AccessToken
41-
cookie from CSRF attacks. It is stored as HTTP_ONLY cookie.
42-
- `refreshToken` - The refresh token, if any. It is stored as HTTP_ONLY cookie.
43-
- `refreshTokenExists` - A boolean value that indicates if a refresh token
44-
exists for the user. It is used to determine if the user is new or not.
39+
40+
- `accessToken` - The JWT token
41+
- `tokenFingerprint` - A random string that is used to protect the AccessToken
42+
cookie from CSRF attacks. It is stored as HTTP_ONLY cookie.
43+
- `refreshToken` - The refresh token, if any. It is stored as HTTP_ONLY cookie.
44+
- `refreshTokenExists` - A boolean value that indicates if a refresh token
45+
exists for the user. It is used to determine if the user is new or not.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"test": "vitest run",
2626
"test:ci": "vitest run --coverage",
2727
"tsc": "tsc --noEmit",
28-
"format": "prettier --write src/ *.json *.js *.ts",
29-
"lint": "eslint *.ts"
28+
"format": "eslint src --fix && prettier --write .",
29+
"lint": "eslint src && prettier --check ."
3030
},
3131
"files": [
3232
"dist",

0 commit comments

Comments
 (0)