@simulacrum/auth0-simulator 0.8.3 → 0.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (117) hide show
  1. package/README.md +28 -206
  2. package/bin/start.js +7 -0
  3. package/dist/auth/constants.d.ts.map +1 -1
  4. package/dist/auth/constants.js +2 -5
  5. package/dist/auth/constants.js.map +1 -1
  6. package/dist/auth/date.js +3 -9
  7. package/dist/auth/date.js.map +1 -1
  8. package/dist/auth/jwt.d.ts +4 -1
  9. package/dist/auth/jwt.d.ts.map +1 -1
  10. package/dist/auth/jwt.js +8 -13
  11. package/dist/auth/jwt.js.map +1 -1
  12. package/dist/auth/refresh-token.d.ts +4 -0
  13. package/dist/auth/refresh-token.d.ts.map +1 -0
  14. package/dist/auth/refresh-token.js +18 -0
  15. package/dist/auth/refresh-token.js.map +1 -0
  16. package/dist/config/get-config.d.ts +6 -6
  17. package/dist/config/get-config.d.ts.map +1 -1
  18. package/dist/config/get-config.js +18 -18
  19. package/dist/config/get-config.js.map +1 -1
  20. package/dist/handlers/auth0-handlers.d.ts +6 -10
  21. package/dist/handlers/auth0-handlers.d.ts.map +1 -1
  22. package/dist/handlers/auth0-handlers.js +81 -66
  23. package/dist/handlers/auth0-handlers.js.map +1 -1
  24. package/dist/handlers/index.d.ts +5 -0
  25. package/dist/handlers/index.d.ts.map +1 -0
  26. package/dist/handlers/index.js +36 -0
  27. package/dist/handlers/index.js.map +1 -0
  28. package/dist/handlers/login-redirect.d.ts +2 -2
  29. package/dist/handlers/login-redirect.d.ts.map +1 -1
  30. package/dist/handlers/login-redirect.js +3 -7
  31. package/dist/handlers/login-redirect.js.map +1 -1
  32. package/dist/handlers/oauth-handlers.d.ts +12 -9
  33. package/dist/handlers/oauth-handlers.d.ts.map +1 -1
  34. package/dist/handlers/oauth-handlers.js +86 -67
  35. package/dist/handlers/oauth-handlers.js.map +1 -1
  36. package/dist/handlers/openid-handlers.d.ts +4 -4
  37. package/dist/handlers/openid-handlers.d.ts.map +1 -1
  38. package/dist/handlers/openid-handlers.js +11 -15
  39. package/dist/handlers/openid-handlers.js.map +1 -1
  40. package/dist/handlers/url.d.ts.map +1 -1
  41. package/dist/handlers/url.js +1 -5
  42. package/dist/handlers/url.js.map +1 -1
  43. package/dist/handlers/utils.d.ts +11 -4
  44. package/dist/handlers/utils.d.ts.map +1 -1
  45. package/dist/handlers/utils.js +11 -15
  46. package/dist/handlers/utils.js.map +1 -1
  47. package/dist/handlers/web-message.d.ts +1 -1
  48. package/dist/handlers/web-message.d.ts.map +1 -1
  49. package/dist/handlers/web-message.js +8 -12
  50. package/dist/handlers/web-message.js.map +1 -1
  51. package/dist/index.d.ts +16 -18
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +18 -127
  54. package/dist/index.js.map +1 -1
  55. package/dist/middleware/create-cors.d.ts +1 -1
  56. package/dist/middleware/create-cors.js +2 -9
  57. package/dist/middleware/create-cors.js.map +1 -1
  58. package/dist/middleware/error-handling.d.ts +3 -0
  59. package/dist/middleware/error-handling.d.ts.map +1 -0
  60. package/dist/{error-handling-middleware.js → middleware/error-handling.js} +5 -11
  61. package/dist/middleware/error-handling.js.map +1 -0
  62. package/dist/middleware/no-cache.d.ts +1 -1
  63. package/dist/middleware/no-cache.js +1 -5
  64. package/dist/middleware/no-cache.js.map +1 -1
  65. package/dist/middleware/session.d.ts +1 -1
  66. package/dist/middleware/session.js +3 -10
  67. package/dist/middleware/session.js.map +1 -1
  68. package/dist/rules/extensionless-file-name.js +1 -5
  69. package/dist/rules/extensionless-file-name.js.map +1 -1
  70. package/dist/rules/parse-rules-files.d.ts.map +1 -1
  71. package/dist/rules/parse-rules-files.js +15 -22
  72. package/dist/rules/parse-rules-files.js.map +1 -1
  73. package/dist/rules/rules-runner.d.ts +2 -2
  74. package/dist/rules/rules-runner.d.ts.map +1 -1
  75. package/dist/rules/rules-runner.js +14 -21
  76. package/dist/rules/rules-runner.js.map +1 -1
  77. package/dist/rules/types.d.ts +1 -1
  78. package/dist/rules/types.d.ts.map +1 -1
  79. package/dist/rules/types.js +1 -2
  80. package/dist/store/entities.d.ts +111 -0
  81. package/dist/store/entities.d.ts.map +1 -0
  82. package/dist/store/entities.js +38 -0
  83. package/dist/store/entities.js.map +1 -0
  84. package/dist/store/index.d.ts +37 -0
  85. package/dist/store/index.d.ts.map +1 -0
  86. package/dist/store/index.js +44 -0
  87. package/dist/store/index.js.map +1 -0
  88. package/dist/types.d.ts +32 -22
  89. package/dist/types.d.ts.map +1 -1
  90. package/dist/types.js +21 -25
  91. package/dist/types.js.map +1 -1
  92. package/dist/views/login.d.ts +2 -2
  93. package/dist/views/login.d.ts.map +1 -1
  94. package/dist/views/login.js +82 -35
  95. package/dist/views/login.js.map +1 -1
  96. package/dist/views/username-password.d.ts +2 -2
  97. package/dist/views/username-password.d.ts.map +1 -1
  98. package/dist/views/username-password.js +3 -7
  99. package/dist/views/username-password.js.map +1 -1
  100. package/dist/views/web-message.d.ts +1 -1
  101. package/dist/views/web-message.d.ts.map +1 -1
  102. package/dist/views/web-message.js +3 -10
  103. package/dist/views/web-message.js.map +1 -1
  104. package/package.json +24 -41
  105. package/CHANGELOG.md +0 -171
  106. package/bin/index.js +0 -2
  107. package/dist/error-handling-middleware.d.ts +0 -3
  108. package/dist/error-handling-middleware.d.ts.map +0 -1
  109. package/dist/error-handling-middleware.js.map +0 -1
  110. package/dist/handlers/get-service-url.d.ts +0 -3
  111. package/dist/handlers/get-service-url.d.ts.map +0 -1
  112. package/dist/handlers/get-service-url.js +0 -11
  113. package/dist/handlers/get-service-url.js.map +0 -1
  114. package/dist/start.d.ts +0 -2
  115. package/dist/start.d.ts.map +0 -1
  116. package/dist/start.js +0 -77
  117. package/dist/start.js.map +0 -1
package/README.md CHANGED
@@ -7,12 +7,12 @@ Read about this simulator on our blog: [Simplified Local Development and Testing
7
7
  - [Auth0 simulator](#auth0-simulator)
8
8
  - [Table of Contents](#table-of-contents)
9
9
  - [Quick Start](#quick-start)
10
- - [Graphql](#graphql)
10
+ - [Using Default User](#using-default-user)
11
11
  - [Code](#code)
12
+ - [Example](#example)
12
13
  - [Configuration](#configuration)
13
14
  - [Options](#options)
14
- - [Services](#services)
15
- - [Rules](#rules)
15
+ - [Rules](#rules)
16
16
  - [Endpoints](#endpoints)
17
17
 
18
18
  Please read the [main README](../../README.md) for more background on simulacrum.
@@ -23,233 +23,63 @@ If this does not meet your needs then please create a github issue to start a co
23
23
 
24
24
  ## Quick Start
25
25
 
26
- This quick start assumes you have your own app with auth0. Check out [`nextjs with auth0 react`](./examples/nextjs-with-auth0-react) and [`nextjs with nextjs auth0`](./examples/nextjs-with-nextjs-auth0) for more complete examples that provides a barebone application.
26
+ This quick start assumes you have your own app with Auth0.
27
27
 
28
- ### Graphql
28
+ > [!IMPORTANT]
29
+ > The Auth0 clients expect the server to be served as `https`, and will throw an error if it is served as `http`. Currently, we rely on a certificate available in the home directory. On first run, you will see instructions on how to set up this certificate through `mkcert`.
29
30
 
30
- Let's start our server.
31
+ ### Using Default User
31
32
 
32
- ```bash
33
- PORT=4000 npx auth0-simulator # this will start a test simulacrum server at http://localhost:4000
34
- ```
33
+ You may start a server directly from the command line.
35
34
 
36
- Open a browser at [http://localhost:4000](http://localhost:4000).
37
-
38
- This will open a graphql graphiql editor.
39
-
40
- Enter the following mutation:
41
-
42
- ```ts
43
- mutation CreateSimulation {
44
- createSimulation(simulator: "auth0",
45
- options: {
46
- options:{
47
- audience: "[your audience]",
48
- scope: "[your scope]",
49
- clientID: "[your client-id]"
50
- },
51
- services:{
52
- auth0:{
53
- port: 4400
54
- }
55
- }
56
- }) {
57
- id
58
- status
59
- services {
60
- url
61
- name
62
- }
63
- }
64
- }
35
+ ```bash
36
+ npx auth0-simulator # this will start a simulation server at http://localhost:4400
65
37
  ```
66
38
 
67
- This mutation creates your first simulation. Every time you start the server, you will need to apply these mutations. This can also be done programmatically which will be your likely interface while writing tests.
68
-
69
- ![create simulation](./docs/create-simulation.png).
70
-
71
- Use the values returned from the query to update your configuration in the client application that calls the auth0 endpoints as shown below. This will point your app at the simulation instead of the Auth0 endpoint.
39
+ Given no further input, it will use the default values as below. This will point your app at the simulation instead of the Auth0 endpoint.
72
40
 
73
41
  ```json
74
42
  {
75
- "domain": "localhost:4400",
76
- "clientID": "00000000000000000000000000000000",
77
- "audience": "https://your-audience/"
43
+ "domain": "https://localhost:4400",
44
+ "clientId": "00000000000000000000000000000000",
45
+ "audience": "https://thefrontside.auth0.com/api/v1/"
78
46
  }
79
47
  ```
80
48
 
81
- Create a fake user whose credentials can be used for authentication with this query.
82
-
83
- ```graphql
84
- mutation CreatePerson {
85
- given(a: "person", simulation: "6fbe024f-2316-4265-a6e8-d65a837e308a")
86
- }
87
- ```
88
-
89
- ![person query](./docs/person.png)
90
-
91
- The fake user can now be used on your app. Use the `email` and `password` fields as login credentials.
92
-
93
49
  You now have a running auth0 server!
94
50
 
95
51
  ### Code
96
52
 
97
- An auth0 simulator can be created using the `@simulacrum/client` package. This is how you would apply the mutations programmatically.
53
+ You may import and run the simulation server in a script.
98
54
 
99
- ```bash
100
- npm install @simulacrum/client
101
- npm install @simulacrum/auth0-simulator
102
- ```
55
+ ```js
56
+ import { simulation } from "@simulacrum/auth0-simulator";
103
57
 
104
- The following examples are written in Typescript, but using Typescript is not a requirement. The Auth0 simulator creates a server with a graphql interface. This means that your interactions with the server can be written in any language or framework that can communicate over http / graphql.
105
-
106
- ```ts
107
- import { main } from "effection";
108
- import { createSimulationServer, Server } from "@simulacrum/server";
109
- import { auth0 } from "@simulacrum/auth0-simulator";
110
- import { createClient } from "@simulacrum/client";
111
-
112
- const port = Number(process.env.PORT) ?? 4000; // port for the main simulation service
113
-
114
- // effection is a structured concurrency library and this will help us handle errors and shutting down the server gracefully
115
- main(function* () {
116
- let server: Server = yield createSimulationServer({
117
- seed: 1,
118
- port,
119
- simulators: { auth0 },
120
- });
121
-
122
- let url = `http://localhost:${server.address.port}`;
123
-
124
- console.log(`simulation server running at ${url}`);
125
-
126
- let client = createClient(url);
127
-
128
- let simulation = yield client.createSimulation("auth0", {
129
- options: {
130
- audience: "[your audience]",
131
- scope: "[your scope]",
132
- clientID: "[your client-id]",
133
- },
134
- services: {
135
- auth0: {
136
- port: 4400, // port for the auth0 service itself
137
- },
138
- },
139
- });
140
-
141
- console.log(`auth0 service running at ${simulation.services[0].url}`);
142
- let person = yield client.given(simulation, "person");
143
-
144
- console.log(`store populated with user`);
145
- console.log(
146
- `username = ${person.data.email} password = ${person.data.password}`
147
- );
148
-
149
- yield;
150
- });
58
+ const app = simulation();
59
+ app.listen(4400, () =>
60
+ console.log(`auth0 simulation server started at https://localhost:4400`)
61
+ );
151
62
  ```
152
63
 
153
- The `client` is also expected to be run in many different contexts, and, as such, supports async/await as well.
64
+ By passing an `initialState`, you may control the initial users in the store.
154
65
 
155
- ```js
156
- import { main } from "effection";
157
- import { createSimulationServer } from "@simulacrum/server";
158
- import { auth0 } from "@simulacrum/auth0-simulator";
159
- import { createClient } from "@simulacrum/client";
160
-
161
- const port = Number(process.env.PORT) || 4000; // port for the main simulation service
162
-
163
- main(function* startServer() {
164
- // the simulation server needs to run within the scope
165
- // of an effection context
166
- let server = yield createSimulationServer({
167
- port,
168
- simulators: { auth0 },
169
- });
170
-
171
- let url = `http://localhost:${server.address.port}`;
172
-
173
- console.log(`simulation server running at ${url}`);
174
-
175
- yield setupClient({ url });
176
- });
177
-
178
- // the client is expected to run anywhere and does not expect
179
- // the effection scope, as such, it also can be used with async/await
180
- async function setupClient({ url }) {
181
- let client = createClient(url);
182
-
183
- let simulation = await client.createSimulation("auth0", {
184
- options: {
185
- audience: "https://your-audience/",
186
- scope: "openid profile email offline_access",
187
- clientID: "YOUR_AUTH0_CLIENT_ID",
188
- },
189
- services: {
190
- auth0: {
191
- port: 4400, // port for the auth0 service itself
192
- },
193
- },
194
- });
195
-
196
- console.log(`auth0 service running at ${simulation.services[0].url}`);
197
-
198
- let person = await client.given(simulation, "person");
199
-
200
- console.log(`store populated with user`);
201
- console.log(
202
- `username = ${person.data.email} password = ${person.data.password}`
203
- );
204
- }
205
- ```
66
+ ### Example
67
+
68
+ The folks at Auth0 maintain many samples such as [github.com/auth0-samples/auth0-react-samples](https://github.com/auth0-samples/auth0-react-samples). Follow the instructions to run the sample, set the configuration in `auth_config.json` to match the defaults as noted above, and run the Auth0 simulation server with `npx auth0-simulator`.
206
69
 
207
70
  ## Configuration
208
71
 
209
- Both the graphql `createSimulation` mutation and the `@simulacrum/client` take an optional `options` and `services` object.
210
-
211
- ```ts
212
- // A snippet from the previous `Code` example.
213
- let simulation = yield client.createSimulation("auth0", {
214
- options: {
215
- audience: "[your audience]",
216
- scope: "[your scope]",
217
- clientID: "[your client-id]",
218
- rulesDirectory: "test/rules",
219
- },
220
- services: {
221
- auth0: {
222
- port: 4400,
223
- },
224
- },
225
- });
226
- ```
72
+ The Auth0 Simulator uses [cosmiconfig](https://github.com/cosmiconfig/cosmiconfig) to load the configuration options. This provides many options in where to place your configuration. Using the module name, `auth0Simulator`, you could, for example, set your configuration in a `.auth0Simulatorrc.json` file.
227
73
 
228
74
  ### Options
229
75
 
230
76
  The `options` field supports the [auth0 configuration fields](https://auth0.com/docs/quickstart/spa/vanillajs#configure-auth0). The option fields should match the fields in the client application that is calling the auth0 server.
231
77
 
232
- The `scope` also accepts an array of objects containing `clientID`, `scope` and optionally `audience` to enable dynamic scopes from a single simulator. This should allow multiple clients to all use the same simulator. Additionally, setting the `clientID: "default"` will enable a default fallback scope so every client does not need to be included.
78
+ The `scope` also accepts an array of objects containing `clientId`, `scope` and optionally `audience` to enable dynamic scopes from a single simulator. This should allow multiple clients to all use the same simulator. Additionally, setting the `clientId: "default"` will enable a default fallback scope so every client does not need to be included.
233
79
 
234
80
  An optional [`rulesDirectory` field](#rules) can specify a directory of [auth0 rules](https://auth0.com/docs/rules) code files, more on this [below](#rules).
235
81
 
236
- ### Services
237
-
238
- The `services` object configures simulators to start on specific ports.
239
-
240
- ```ts
241
- let simulation = yield client.createSimulation("auth0", {
242
- options: {
243
- services: {
244
- auth0: {
245
- port: 4400,
246
- },
247
- },
248
- },
249
- });
250
- ```
251
-
252
- ## Rules
82
+ ### Rules
253
83
 
254
84
  It is possible to run [auth0 rules](https://auth0.com/docs/rules) if the compiled code files are on disk and all located in the same directory.
255
85
 
@@ -259,14 +89,6 @@ For example, a [sample rules directory](./test/rules) is in the auth0 package fo
259
89
 
260
90
  If we want to run these rules files then we would add the `rulesDirectory` field to the [options object](#options).
261
91
 
262
- ```ts
263
- let simulation = yield client.createSimulation(url, {
264
- options: {
265
- rulesDirectory: "test/rules",
266
- },
267
- });
268
- ```
269
-
270
92
  ## Endpoints
271
93
 
272
94
  The following endpoints have been assigned handlers:
package/bin/start.js ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ const auth0APIsimulator = require("../dist/index");
3
+
4
+ const app = auth0APIsimulator.simulation();
5
+ app.listen(4400, () =>
6
+ console.log(`auth0 simulation server started at https://localhost:4400`)
7
+ );
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,+qDACspD,CAAC;AAE/qD,eAAO,MAAM,IAAI;;;;;;;;;CAYhB,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,+qDACspD,CAAC;AAE/qD,eAAO,MAAM,IAAI;;;;;;;;;CAWhB,CAAC"}
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JWKS = exports.PRIVATE_KEY = void 0;
4
- exports.PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----~~MIIEpAIBAAKCAQEAwzwwEqR5p7a6CaG61i3od+GLTyype3t/f0pwwtoA9NsZANcj~~HaAUR/qzqlNRQlLI687vF1OfbETYLeHIT5V36QGrMf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zGDYIGlVm5IReC3P6Caw==~~-----END RSA PRIVATE KEY-----~~";
2
+ export const JWKS = {
6
3
  keys: [
7
4
  {
8
5
  kty: "RSA",
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,WAAW,GACtB,4qDAA4qD,CAAC;AAElqD,QAAA,IAAI,GAAG;IAClB,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,KAAK;YACV,CAAC,EACC,wVAAwV;YAC1V,CAAC,EAAE,MAAM;YACT,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,wDAAwD;YAC7D,GAAG,EAAE,KAAK;SACX;KACF;CACF,CAAC"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/auth/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GACtB,4qDAA4qD,CAAC;AAE/qD,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE;QACJ;YACE,GAAG,EAAE,KAAK;YACV,CAAC,EAAE,wVAAwV;YAC3V,CAAC,EAAE,MAAM;YACT,GAAG,EAAE,OAAO;YACZ,GAAG,EAAE,wDAAwD;YAC7D,GAAG,EAAE,KAAK;SACX;KACF;CACF,CAAC"}
package/dist/auth/date.js CHANGED
@@ -1,14 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.epochTimeToLocalDate = exports.expiresAt = exports.epochTime = void 0;
4
- const epochTime = (date = Date.now()) => Math.floor(date / 1000);
5
- exports.epochTime = epochTime;
6
- const expiresAt = (hours = 1) => (0, exports.epochTime)() + hours * 60 * 60 * 1000;
7
- exports.expiresAt = expiresAt;
8
- const epochTimeToLocalDate = (epoch) => {
1
+ export const epochTime = (date = Date.now()) => Math.floor(date / 1000);
2
+ export const expiresAt = (hours = 1) => epochTime() + hours * 60 * 60 * 1000;
3
+ export const epochTimeToLocalDate = (epoch) => {
9
4
  let date = new Date(0);
10
5
  date.setUTCSeconds(epoch);
11
6
  return date;
12
7
  };
13
- exports.epochTimeToLocalDate = epochTimeToLocalDate;
14
8
  //# sourceMappingURL=date.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/auth/date.ts"],"names":[],"mappings":";;;AAAO,MAAM,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAAnE,QAAA,SAAS,aAA0D;AAEzE,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,EAAU,EAAE,CAC7C,IAAA,iBAAS,GAAE,GAAG,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAD1B,QAAA,SAAS,aACiB;AAEhC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAQ,EAAE;IAC1D,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAJW,QAAA,oBAAoB,wBAI/B"}
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/auth/date.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,EAAE,EAAU,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AAEhF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,KAAK,GAAG,CAAC,EAAU,EAAE,CAC7C,SAAS,EAAE,GAAG,KAAK,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AAEvC,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAQ,EAAE;IAC1D,IAAI,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACvB,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC"}
@@ -1,4 +1,7 @@
1
1
  import type { SignOptions } from "jsonwebtoken";
2
+ import { sign } from "jsonwebtoken";
2
3
  export declare const parseKey: (key: string) => string;
3
- export declare const createJsonWebToken: (payload: Record<string, unknown>, privateKey?: string, options?: SignOptions) => string;
4
+ type SignPayload = Parameters<typeof sign>[0];
5
+ export declare function createJsonWebToken<P extends SignPayload>(payload: P, privateKey?: string, options?: SignOptions): string;
6
+ export {};
4
7
  //# sourceMappingURL=jwt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAIhD,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAAoC,CAAC;AAE5E,eAAO,MAAM,kBAAkB,YACpB,OAAO,MAAM,EAAE,OAAO,CAAC,iCAEvB,WAAW,KAInB,MAEF,CAAC"}
1
+ {"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAAoC,CAAC;AAE5E,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,CAAC,SAAS,WAAW,EACtD,OAAO,EAAE,CAAC,EACV,UAAU,SAAwB,EAClC,OAAO,GAAE,WAGR,GACA,MAAM,CAER"}
package/dist/auth/jwt.js CHANGED
@@ -1,15 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createJsonWebToken = exports.parseKey = void 0;
4
- const jsonwebtoken_1 = require("jsonwebtoken");
5
- const constants_1 = require("./constants");
6
- const parseKey = (key) => key.split("~~").join("\n");
7
- exports.parseKey = parseKey;
8
- const createJsonWebToken = (payload, privateKey = (0, exports.parseKey)(constants_1.PRIVATE_KEY), options = {
1
+ import { sign } from "jsonwebtoken";
2
+ import { JWKS, PRIVATE_KEY } from "./constants";
3
+ export const parseKey = (key) => key.split("~~").join("\n");
4
+ export function createJsonWebToken(payload, privateKey = parseKey(PRIVATE_KEY), options = {
9
5
  algorithm: "RS256",
10
- keyid: constants_1.JWKS.keys[0].kid,
11
- }) => {
12
- return (0, jsonwebtoken_1.sign)(payload, privateKey, options);
13
- };
14
- exports.createJsonWebToken = createJsonWebToken;
6
+ keyid: JWKS.keys[0].kid,
7
+ }) {
8
+ return sign(payload, privateKey, options);
9
+ }
15
10
  //# sourceMappingURL=jwt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":";;;AACA,+CAAoC;AACpC,2CAAgD;AAEzC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAA/D,QAAA,QAAQ,YAAuD;AAErE,MAAM,kBAAkB,GAAG,CAChC,OAAgC,EAChC,UAAU,GAAG,IAAA,gBAAQ,EAAC,uBAAW,CAAC,EAClC,UAAuB;IACrB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,gBAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;CACxB,EACO,EAAE;IACV,OAAO,IAAA,mBAAI,EAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC,CAAC;AATW,QAAA,kBAAkB,sBAS7B"}
1
+ {"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAI5E,MAAM,UAAU,kBAAkB,CAChC,OAAU,EACV,UAAU,GAAG,QAAQ,CAAC,WAAW,CAAC,EAClC,UAAuB;IACrB,SAAS,EAAE,OAAO;IAClB,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG;CACxB;IAED,OAAO,IAAI,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { GrantType, RefreshToken } from "../types";
2
+ export declare function issueRefreshToken(scope: string, grantType: GrantType): boolean;
3
+ export declare function createRefreshToken({ exp, rotations, scope, user, nonce, }: Omit<RefreshToken, "iat">): string;
4
+ //# sourceMappingURL=refresh-token.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-token.d.ts","sourceRoot":"","sources":["../../src/auth/refresh-token.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKxD,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,SAAS,GACnB,OAAO,CAET;AAED,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,SAAa,EACb,KAAK,EACL,IAAI,EACJ,KAAK,GACN,EAAE,IAAI,CAAC,YAAY,EAAE,KAAK,CAAC,GAAG,MAAM,CAapC"}
@@ -0,0 +1,18 @@
1
+ import { epochTime } from "./date";
2
+ import { encode } from "base64-url";
3
+ import { assert } from "assert-ts";
4
+ export function issueRefreshToken(scope, grantType) {
5
+ return grantType === "refresh_token" || scope.includes("offline_access");
6
+ }
7
+ export function createRefreshToken({ exp, rotations = 0, scope, user, nonce, }) {
8
+ assert(!!user.id, `no identifier for user`);
9
+ return encode(JSON.stringify({
10
+ exp,
11
+ iat: epochTime(),
12
+ rotations,
13
+ scope,
14
+ user: { id: user.id },
15
+ nonce,
16
+ }));
17
+ }
18
+ //# sourceMappingURL=refresh-token.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"refresh-token.js","sourceRoot":"","sources":["../../src/auth/refresh-token.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,MAAM,UAAU,iBAAiB,CAC/B,KAAa,EACb,SAAoB;IAEpB,OAAO,SAAS,KAAK,eAAe,IAAI,KAAK,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC;AAC3E,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,EACjC,GAAG,EACH,SAAS,GAAG,CAAC,EACb,KAAK,EACL,IAAI,EACJ,KAAK,GACqB;IAC1B,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,EAAE,wBAAwB,CAAC,CAAC;IAE5C,OAAO,MAAM,CACX,IAAI,CAAC,SAAS,CAAC;QACb,GAAG;QACH,GAAG,EAAE,SAAS,EAAE;QAChB,SAAS;QACT,KAAK;QACL,IAAI,EAAE,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE;QACrB,KAAK;KACN,CAAC,CACH,CAAC;AACJ,CAAC"}
@@ -1,8 +1,8 @@
1
- import { cosmiconfigSync } from 'cosmiconfig';
2
- import type { Auth0Configuration, Schema } from '../types';
3
- export declare const DefaultArgs: Schema;
4
- declare type Explorer = ReturnType<typeof cosmiconfigSync>;
5
- export declare function getConfigCreator(explorer: Explorer): (options?: Partial<Auth0Configuration> | undefined) => Auth0Configuration;
6
- export declare const getConfig: (options?: Partial<Auth0Configuration> | undefined) => Auth0Configuration;
1
+ import { cosmiconfigSync } from "cosmiconfig";
2
+ import type { Auth0Configuration, ConfigSchema } from "../types";
3
+ export declare const DefaultArgs: ConfigSchema;
4
+ type Explorer = ReturnType<typeof cosmiconfigSync>;
5
+ export declare function getConfigCreator(explorer: Explorer): (options?: Partial<Auth0Configuration>) => Auth0Configuration;
6
+ export declare const getConfig: (options?: Partial<Auth0Configuration>) => Auth0Configuration;
7
7
  export {};
8
8
  //# sourceMappingURL=get-config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAK3D,eAAO,MAAM,WAAW,EAAE,MAIzB,CAAC;AAEF,aAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAkBnD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,0DACiB,kBAAkB,CAgBrF;AAID,eAAO,MAAM,SAAS,yDApB8C,kBAoBjB,CAAC"}
1
+ {"version":3,"file":"get-config.d.ts","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAKjE,eAAO,MAAM,WAAW,EAAE,YAIzB,CAAC;AAEF,KAAK,QAAQ,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAkBnD,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,cAErC,OAAO,CAAC,kBAAkB,CAAC,KACpC,kBAAkB,CAoBtB;AAID,eAAO,MAAM,SAAS,aAzBR,OAAO,CAAC,kBAAkB,CAAC,KACpC,kBAwB8C,CAAC"}
@@ -1,39 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getConfig = exports.getConfigCreator = exports.DefaultArgs = void 0;
4
- const cosmiconfig_1 = require("cosmiconfig");
5
- const types_1 = require("../types");
1
+ import { cosmiconfigSync } from "cosmiconfig";
2
+ import { configurationSchema } from "../types";
6
3
  const DefaultAuth0Port = 4400;
7
- exports.DefaultArgs = {
8
- clientID: '00000000000000000000000000000000',
9
- audience: 'https://thefrontside.auth0.com/api/v1/',
4
+ export const DefaultArgs = {
5
+ clientID: "00000000000000000000000000000000",
6
+ audience: "https://thefrontside.auth0.com/api/v1/",
10
7
  scope: "openid profile email offline_access",
11
8
  };
12
9
  function getPort({ domain, port }) {
13
- if (typeof port === 'number') {
10
+ if (typeof port === "number") {
14
11
  return port;
15
12
  }
16
13
  if (domain) {
17
- if (domain.split(':').length === 2) {
18
- return parseInt(domain.split(':')[1]);
14
+ if (domain.split(":").length === 2) {
15
+ return parseInt(domain.split(":")[1]);
19
16
  }
20
17
  }
21
18
  return DefaultAuth0Port;
22
19
  }
23
20
  // This higher order function would only be used for testing and
24
21
  // allows different cosmiconfig instances to be used for testing
25
- function getConfigCreator(explorer) {
22
+ export function getConfigCreator(explorer) {
26
23
  return function getConfig(options) {
27
24
  let searchResult = explorer.search();
28
- let config = searchResult === null ? exports.DefaultArgs : searchResult.config;
25
+ let config = searchResult === null ? DefaultArgs : searchResult.config;
29
26
  let strippedOptions = options !== null && options !== void 0 ? options : {};
30
- let configuration = { ...exports.DefaultArgs, ...config, ...strippedOptions };
27
+ let configuration = {
28
+ ...DefaultArgs,
29
+ ...config,
30
+ ...strippedOptions,
31
+ };
31
32
  configuration.port = getPort(configuration);
32
- types_1.configurationSchema.parse(configuration);
33
+ configurationSchema.parse(configuration);
33
34
  return configuration;
34
35
  };
35
36
  }
36
- exports.getConfigCreator = getConfigCreator;
37
- const explorer = (0, cosmiconfig_1.cosmiconfigSync)("auth0Simulator");
38
- exports.getConfig = getConfigCreator(explorer);
37
+ const explorer = cosmiconfigSync("auth0Simulator");
38
+ export const getConfig = getConfigCreator(explorer);
39
39
  //# sourceMappingURL=get-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-config.js","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":";;;AAAA,6CAA8C;AAE9C,oCAA+C;AAE/C,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAEjB,QAAA,WAAW,GAAW;IACjC,QAAQ,EAAE,kCAAkC;IAC5C,QAAQ,EAAE,wCAAwC;IAClD,KAAK,EAAE,qCAAqC;CAC7C,CAAC;AAIF,SAAS,OAAO,CAAC,EAAE,MAAM,EAAE,IAAI,EAAsB;IACnD,IAAG,OAAO,IAAI,KAAK,QAAQ,EAAE;QAC3B,OAAO,IAAI,CAAC;KACb;IAED,IAAG,MAAM,EAAE;QACT,IAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,OAAO,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACvC;KACF;IAED,OAAO,gBAAgB,CAAC;AAC1B,CAAC;AAED,gEAAgE;AAChE,gEAAgE;AAChE,SAAgB,gBAAgB,CAAC,QAAkB;IACjD,OAAO,SAAS,SAAS,CAAC,OAAqC;QAC7D,IAAI,YAAY,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAErC,IAAI,MAAM,GACR,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,mBAAW,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC;QAE5D,IAAI,eAAe,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;QAEpC,IAAI,aAAa,GAAG,EAAE,GAAG,mBAAW,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AAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAErC,IAAI,MAAM,GACR,YAAY,KAAK,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC;QAE5D,IAAI,eAAe,GAAG,OAAO,aAAP,OAAO,cAAP,OAAO,GAAI,EAAE,CAAC;QAEpC,IAAI,aAAa,GAAG;YAClB,GAAG,WAAW;YACd,GAAG,MAAM;YACT,GAAG,eAAe;SACG,CAAC;QAExB,aAAa,CAAC,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;QAE5C,mBAAmB,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;QAEzC,OAAO,aAAa,CAAC;IACvB,CAAC,CAAC;AACJ,CAAC;AAED,MAAM,QAAQ,GAAG,eAAe,CAAC,gBAAgB,CAAC,CAAC;AAEnD,MAAM,CAAC,MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC"}
@@ -1,14 +1,10 @@
1
- import type { Person } from '@simulacrum/server';
2
- import type { Auth0Configuration } from '../types';
3
- import type { RequestHandler } from 'express';
4
- export declare type Routes = '/heartbeat' | '/authorize' | '/login' | '/usernamepassword/login' | '/login/callback' | '/oauth/token' | '/v2/logout' | '/userinfo';
5
- export declare type AuthSession = {
1
+ import type { ExtendedSimulationStore } from "../store";
2
+ import type { Request, RequestHandler } from "express";
3
+ import type { Auth0Configuration } from "../types";
4
+ export type Routes = "/heartbeat" | "/authorize" | "/login" | "/usernamepassword/login" | "/login/callback" | "/oauth/token" | "/v2/logout" | "/userinfo";
5
+ export type AuthSession = {
6
6
  username: string;
7
7
  nonce: string;
8
8
  };
9
- export interface Auth0Store {
10
- get(nonce: string): AuthSession;
11
- set(nonce: string, session: AuthSession): void;
12
- }
13
- export declare const createAuth0Handlers: (store: Auth0Store, people: Iterable<Person>, serviceURL: () => URL, options: Auth0Configuration, debug: boolean) => Record<Routes, RequestHandler>;
9
+ export declare const createAuth0Handlers: (simulationStore: ExtendedSimulationStore, serviceURL: (request: Request) => string, options: Auth0Configuration, debug: boolean) => Record<Routes, RequestHandler>;
14
10
  //# sourceMappingURL=auth0-handlers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"auth0-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/auth0-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAA8B,MAAM,UAAU,CAAC;AAC/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAY9C,oBAAY,MAAM,GACd,YAAY,GACZ,YAAY,GACZ,QAAQ,GACR,yBAAyB,GACzB,iBAAiB,GACjB,cAAc,GACd,YAAY,GACZ,WAAW,CAAA;AAEf,oBAAY,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAE9D,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAAC;IAChC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,IAAI,CAAC;CAChD;AAcD,eAAO,MAAM,mBAAmB,UAAW,UAAU,UAAU,SAAS,MAAM,CAAC,cAAc,MAAM,GAAG,WAAW,kBAAkB,SAAS,OAAO,KAAG,OAAO,MAAM,EAAE,cAAc,CA+LlL,CAAC"}
1
+ {"version":3,"file":"auth0-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/auth0-handlers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AACxD,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACvD,OAAO,KAAK,EAAE,kBAAkB,EAA8B,MAAM,UAAU,CAAC;AAY/E,MAAM,MAAM,MAAM,GACd,YAAY,GACZ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