@simulacrum/auth0-simulator 0.9.0 → 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.
- package/README.md +28 -206
- package/bin/start.js +7 -0
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js +2 -5
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/date.js +3 -9
- package/dist/auth/date.js.map +1 -1
- package/dist/auth/jwt.d.ts +1 -1
- package/dist/auth/jwt.d.ts.map +1 -1
- package/dist/auth/jwt.js +6 -11
- package/dist/auth/jwt.js.map +1 -1
- package/dist/auth/refresh-token.d.ts +2 -2
- package/dist/auth/refresh-token.d.ts.map +1 -1
- package/dist/auth/refresh-token.js +10 -15
- package/dist/auth/refresh-token.js.map +1 -1
- package/dist/config/get-config.d.ts +6 -6
- package/dist/config/get-config.d.ts.map +1 -1
- package/dist/config/get-config.js +18 -18
- package/dist/config/get-config.js.map +1 -1
- package/dist/handlers/auth0-handlers.d.ts +6 -10
- package/dist/handlers/auth0-handlers.d.ts.map +1 -1
- package/dist/handlers/auth0-handlers.js +81 -66
- package/dist/handlers/auth0-handlers.js.map +1 -1
- package/dist/handlers/index.d.ts +5 -0
- package/dist/handlers/index.d.ts.map +1 -0
- package/dist/handlers/index.js +36 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/login-redirect.d.ts +2 -2
- package/dist/handlers/login-redirect.d.ts.map +1 -1
- package/dist/handlers/login-redirect.js +3 -7
- package/dist/handlers/login-redirect.js.map +1 -1
- package/dist/handlers/oauth-handlers.d.ts +10 -9
- package/dist/handlers/oauth-handlers.d.ts.map +1 -1
- package/dist/handlers/oauth-handlers.js +55 -58
- package/dist/handlers/oauth-handlers.js.map +1 -1
- package/dist/handlers/openid-handlers.d.ts +4 -4
- package/dist/handlers/openid-handlers.d.ts.map +1 -1
- package/dist/handlers/openid-handlers.js +11 -15
- package/dist/handlers/openid-handlers.js.map +1 -1
- package/dist/handlers/url.d.ts.map +1 -1
- package/dist/handlers/url.js +1 -5
- package/dist/handlers/url.js.map +1 -1
- package/dist/handlers/utils.d.ts +11 -4
- package/dist/handlers/utils.d.ts.map +1 -1
- package/dist/handlers/utils.js +11 -15
- package/dist/handlers/utils.js.map +1 -1
- package/dist/handlers/web-message.d.ts +1 -1
- package/dist/handlers/web-message.d.ts.map +1 -1
- package/dist/handlers/web-message.js +8 -12
- package/dist/handlers/web-message.js.map +1 -1
- package/dist/index.d.ts +16 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -127
- package/dist/index.js.map +1 -1
- package/dist/middleware/create-cors.d.ts +1 -1
- package/dist/middleware/create-cors.js +2 -9
- package/dist/middleware/create-cors.js.map +1 -1
- package/dist/middleware/error-handling.d.ts +3 -0
- package/dist/middleware/error-handling.d.ts.map +1 -0
- package/dist/{error-handling-middleware.js → middleware/error-handling.js} +5 -11
- package/dist/middleware/error-handling.js.map +1 -0
- package/dist/middleware/no-cache.d.ts +1 -1
- package/dist/middleware/no-cache.js +1 -5
- package/dist/middleware/no-cache.js.map +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.js +3 -10
- package/dist/middleware/session.js.map +1 -1
- package/dist/rules/extensionless-file-name.js +1 -5
- package/dist/rules/extensionless-file-name.js.map +1 -1
- package/dist/rules/parse-rules-files.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.js +15 -22
- package/dist/rules/parse-rules-files.js.map +1 -1
- package/dist/rules/rules-runner.d.ts +2 -2
- package/dist/rules/rules-runner.d.ts.map +1 -1
- package/dist/rules/rules-runner.js +14 -21
- package/dist/rules/rules-runner.js.map +1 -1
- package/dist/rules/types.d.ts +1 -1
- package/dist/rules/types.d.ts.map +1 -1
- package/dist/rules/types.js +1 -2
- package/dist/store/entities.d.ts +111 -0
- package/dist/store/entities.d.ts.map +1 -0
- package/dist/store/entities.js +38 -0
- package/dist/store/entities.js.map +1 -0
- package/dist/store/index.d.ts +37 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +44 -0
- package/dist/store/index.js.map +1 -0
- package/dist/types.d.ts +20 -20
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +21 -25
- package/dist/types.js.map +1 -1
- package/dist/views/login.d.ts +2 -2
- package/dist/views/login.d.ts.map +1 -1
- package/dist/views/login.js +81 -34
- package/dist/views/login.js.map +1 -1
- package/dist/views/username-password.d.ts +2 -2
- package/dist/views/username-password.d.ts.map +1 -1
- package/dist/views/username-password.js +3 -7
- package/dist/views/username-password.js.map +1 -1
- package/dist/views/web-message.d.ts +1 -1
- package/dist/views/web-message.d.ts.map +1 -1
- package/dist/views/web-message.js +3 -10
- package/dist/views/web-message.js.map +1 -1
- package/package.json +24 -41
- package/CHANGELOG.md +0 -176
- package/bin/index.js +0 -2
- package/dist/error-handling-middleware.d.ts +0 -3
- package/dist/error-handling-middleware.d.ts.map +0 -1
- package/dist/error-handling-middleware.js.map +0 -1
- package/dist/handlers/get-service-url.d.ts +0 -3
- package/dist/handlers/get-service-url.d.ts.map +0 -1
- package/dist/handlers/get-service-url.js +0 -11
- package/dist/handlers/get-service-url.js.map +0 -1
- package/dist/start.d.ts +0 -2
- package/dist/start.d.ts.map +0 -1
- package/dist/start.js +0 -77
- 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
|
-
- [
|
|
10
|
+
- [Using Default User](#using-default-user)
|
|
11
11
|
- [Code](#code)
|
|
12
|
+
- [Example](#example)
|
|
12
13
|
- [Configuration](#configuration)
|
|
13
14
|
- [Options](#options)
|
|
14
|
-
- [
|
|
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
|
|
26
|
+
This quick start assumes you have your own app with Auth0.
|
|
27
27
|
|
|
28
|
-
|
|
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
|
-
|
|
31
|
+
### Using Default User
|
|
31
32
|
|
|
32
|
-
|
|
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
|
-
|
|
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
|
-
|
|
68
|
-
|
|
69
|
-
.
|
|
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
|
-
"
|
|
77
|
-
"audience": "https://
|
|
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
|
-

|
|
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
|
-
|
|
53
|
+
You may import and run the simulation server in a script.
|
|
98
54
|
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
npm install @simulacrum/auth0-simulator
|
|
102
|
-
```
|
|
55
|
+
```js
|
|
56
|
+
import { simulation } from "@simulacrum/auth0-simulator";
|
|
103
57
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
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
|
-
|
|
64
|
+
By passing an `initialState`, you may control the initial users in the store.
|
|
154
65
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
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
|
-
|
|
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 `
|
|
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
|
-
###
|
|
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
|
@@ -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;;;;;;;;;
|
|
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"}
|
package/dist/auth/constants.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.JWKS = exports.PRIVATE_KEY = void 0;
|
|
4
|
-
exports.PRIVATE_KEY = "-----BEGIN RSA PRIVATE KEY-----~~MIIEpAIBAAKCAQEAwzwwEqR5p7a6CaG61i3od+GLTyype3t/f0pwwtoA9NsZANcj~~HaAUR/qzqlNRQlLI687vF1OfbETYLeHIT5V36QGrMfrYR/tYAoaKFixC/wOjt8EB~~PoeHgaTOAyGf3V3YNwocNU+StyV1X4hPmDjCrapNYpbKIcAJwq5Ij0WBKGNXBcUU~~bAceRtLqgzf/6x2vcQJeE5nJK5gd41f/jtlK9Xge0Ig6CcdKOI7U3agyI/iNF3SL~~0bnCfvtDRIkgAzzeN5Yj4S3Z4rJV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TU+bi7VDEEhTmRKyfO~~yyVAGzTpAoGBAOmPbnMBAJYLk0SiQVspxIT+LW3tDWc7aFr/TtqAXkEVxI2xG6wA~~dEyRasBbPJDSWEljMre4g/6GG1fsPj0l5n2S8azy6jIu49ANvZPrrrBsuVYStR18~~MibzxjWWUht3vOCZBKtbqgHbC/oc49jMLPO5XrDFMTJPU5GkWRRLRZArAoGBANX+~~H6NQ7fUg8TUerXEB1WqA+FH4zVqJ/NKjbqaj9FPFWG59AjBVqQ335QzDWNCs/LjD~~REF/6qMeP2adehNhEVv2nK3rS+po9b4yLkiSysLivFPry9AxMGzFr3XzgoDb+y+y~~T02zj2k7nkGlNSSSanIxsp+TzTKsIY7ZbGx6d8y/AoGAS/kSDmq3DBe70cmNxN+z~~QyeDE4zWnUvfyCngNocnIbi49PY1cB+9tOJgfS2wZ9NkUIrqBoUIupRY9KKuJCnd~~7d8MqhtiPuytwhGWJzW030KejvcK3wp1LeKCCRBaqQCr+csMj8kDZhMgtD0NiInx~~3V3hBVM/i4PuRSPWrhlGCX0CgYEAq/xR8TBaD2kqc0b0np6ap75/1WHhqaK9T42K~~oOOkuq8hI6vU1oQCGvfhXyChgRWHB/foI7xrGC53RkHKm0ioawEJa75whTVWTEaI~~bEuOKpOQSOJ6LBlckg9PtbzAZlBm0S6+DfUCjdEcoCXnUD1cz+qhZR+lC9TMI8Mb~~IRRMtIECgYBrVlenf/rHK1UMC3FDmkOzH7agShcDHqzFMR1/NcMDolZNXXFy/u4t~~nDxci1smAUQr4oNs1lk9UzCdt0+pVCjmhbriBngwsS6sazOesDft53w6RTczsRpa~~09YDfcXhnI5yT+vd5r4xA5HhyniY7W1ahSzGDYIGlVm5IReC3P6Caw==~~-----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":"
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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
|
package/dist/auth/date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"date.js","sourceRoot":"","sources":["../../src/auth/date.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/auth/jwt.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SignOptions } from "jsonwebtoken";
|
|
2
2
|
import { sign } from "jsonwebtoken";
|
|
3
3
|
export declare const parseKey: (key: string) => string;
|
|
4
|
-
|
|
4
|
+
type SignPayload = Parameters<typeof sign>[0];
|
|
5
5
|
export declare function createJsonWebToken<P extends SignPayload>(payload: P, privateKey?: string, options?: SignOptions): string;
|
|
6
6
|
export {};
|
|
7
7
|
//# sourceMappingURL=jwt.d.ts.map
|
package/dist/auth/jwt.d.ts.map
CHANGED
|
@@ -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;AAChD,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAGpC,eAAO,MAAM,QAAQ,QAAS,MAAM,KAAG,MAAoC,CAAC;AAE5E,
|
|
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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const constants_1 = require("./constants");
|
|
6
|
-
const parseKey = (key) => key.split("~~").join("\n");
|
|
7
|
-
exports.parseKey = parseKey;
|
|
8
|
-
function 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:
|
|
6
|
+
keyid: JWKS.keys[0].kid,
|
|
11
7
|
}) {
|
|
12
|
-
return
|
|
8
|
+
return sign(payload, privateKey, options);
|
|
13
9
|
}
|
|
14
|
-
exports.createJsonWebToken = createJsonWebToken;
|
|
15
10
|
//# sourceMappingURL=jwt.js.map
|
package/dist/auth/jwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../../src/auth/jwt.ts"],"names":[],"mappings":"
|
|
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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { GrantType, RefreshToken } from
|
|
1
|
+
import type { GrantType, RefreshToken } from "../types";
|
|
2
2
|
export declare function issueRefreshToken(scope: string, grantType: GrantType): boolean;
|
|
3
|
-
export declare function createRefreshToken({ exp, rotations, scope, user, nonce }: Omit<RefreshToken,
|
|
3
|
+
export declare function createRefreshToken({ exp, rotations, scope, user, nonce, }: Omit<RefreshToken, "iat">): string;
|
|
4
4
|
//# sourceMappingURL=refresh-token.d.ts.map
|
|
@@ -1 +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,
|
|
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"}
|
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const assert_ts_1 = require("assert-ts");
|
|
7
|
-
function issueRefreshToken(scope, grantType) {
|
|
8
|
-
return grantType === 'refresh_token' || scope.includes('offline_access');
|
|
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");
|
|
9
6
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
return (0, base64_url_1.encode)(JSON.stringify({
|
|
7
|
+
export function createRefreshToken({ exp, rotations = 0, scope, user, nonce, }) {
|
|
8
|
+
assert(!!user.id, `no identifier for user`);
|
|
9
|
+
return encode(JSON.stringify({
|
|
14
10
|
exp,
|
|
15
|
-
iat:
|
|
11
|
+
iat: epochTime(),
|
|
16
12
|
rotations,
|
|
17
13
|
scope,
|
|
18
14
|
user: { id: user.id },
|
|
19
|
-
nonce
|
|
15
|
+
nonce,
|
|
20
16
|
}));
|
|
21
17
|
}
|
|
22
|
-
exports.createRefreshToken = createRefreshToken;
|
|
23
18
|
//# sourceMappingURL=refresh-token.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"refresh-token.js","sourceRoot":"","sources":["../../src/auth/refresh-token.ts"],"names":[],"mappings":"
|
|
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
|
|
2
|
-
import type { Auth0Configuration,
|
|
3
|
-
export declare const DefaultArgs:
|
|
4
|
-
|
|
5
|
-
export declare function getConfigCreator(explorer: Explorer): (options?: Partial<Auth0Configuration>
|
|
6
|
-
export declare const getConfig: (options?: Partial<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,
|
|
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
|
-
|
|
2
|
-
|
|
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
|
-
|
|
8
|
-
clientID:
|
|
9
|
-
audience:
|
|
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 ===
|
|
10
|
+
if (typeof port === "number") {
|
|
14
11
|
return port;
|
|
15
12
|
}
|
|
16
13
|
if (domain) {
|
|
17
|
-
if (domain.split(
|
|
18
|
-
return parseInt(domain.split(
|
|
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 ?
|
|
25
|
+
let config = searchResult === null ? DefaultArgs : searchResult.config;
|
|
29
26
|
let strippedOptions = options !== null && options !== void 0 ? options : {};
|
|
30
|
-
let configuration = {
|
|
27
|
+
let configuration = {
|
|
28
|
+
...DefaultArgs,
|
|
29
|
+
...config,
|
|
30
|
+
...strippedOptions,
|
|
31
|
+
};
|
|
31
32
|
configuration.port = getPort(configuration);
|
|
32
|
-
|
|
33
|
+
configurationSchema.parse(configuration);
|
|
33
34
|
return configuration;
|
|
34
35
|
};
|
|
35
36
|
}
|
|
36
|
-
|
|
37
|
-
const
|
|
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":"
|
|
1
|
+
{"version":3,"file":"get-config.js","sourceRoot":"","sources":["../../src/config/get-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAE/C,MAAM,gBAAg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MAAM,SAAS,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC"}
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { RequestHandler } from
|
|
3
|
-
import type { Auth0Configuration } from
|
|
4
|
-
export
|
|
5
|
-
export
|
|
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
|
|
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,
|
|
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,YAAY,GACZ,QAAQ,GACR,yBAAyB,GACzB,iBAAiB,GACjB,cAAc,GACd,YAAY,GACZ,WAAW,CAAC;AAEhB,MAAM,MAAM,WAAW,GAAG;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAc9D,eAAO,MAAM,mBAAmB,oBACb,uBAAuB,cAC5B,CAAC,OAAO,EAAE,OAAO,KAAK,MAAM,WAC/B,kBAAkB,SACpB,OAAO,KACb,MAAM,CAAC,MAAM,EAAE,cAAc,CA8N/B,CAAC"}
|