@simulacrum/auth0-simulator 0.9.0 → 0.10.1
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 +14 -0
- package/dist/auth/constants.d.ts.map +1 -1
- package/dist/auth/constants.js.map +1 -1
- package/dist/auth/date.d.ts.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 +5 -5
- 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 +7 -8
- 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 +10 -10
- 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 +96 -70
- 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 +43 -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.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 +56 -50
- 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 +10 -10
- package/dist/handlers/openid-handlers.js.map +1 -1
- package/dist/handlers/url.d.ts.map +1 -1
- package/dist/handlers/url.js +1 -1
- 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 +5 -4
- 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 +3 -3
- 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 +22 -125
- package/dist/index.js.map +1 -1
- package/dist/middleware/create-cors.d.ts +1 -1
- 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 -8
- package/dist/middleware/error-handling.js.map +1 -0
- package/dist/middleware/no-cache.d.ts +1 -1
- package/dist/middleware/session.d.ts +1 -1
- package/dist/middleware/session.js.map +1 -1
- package/dist/rules/extensionless-file-name.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.d.ts.map +1 -1
- package/dist/rules/parse-rules-files.js +7 -8
- 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 +49 -41
- 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/store/entities.d.ts +111 -0
- package/dist/store/entities.d.ts.map +1 -0
- package/dist/store/entities.js +43 -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 +40 -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 +10 -11
- 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 -30
- 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/web-message.d.ts +1 -1
- package/dist/views/web-message.d.ts.map +1 -1
- package/dist/views/web-message.js.map +1 -1
- package/package.json +26 -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
|
@@ -1,39 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.createAuth0Handlers = void 0;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
13
|
+
const login_redirect_ts_1 = require("./login-redirect.js");
|
|
14
|
+
const web_message_ts_1 = require("./web-message.js");
|
|
15
|
+
const login_ts_1 = require("../views/login.js");
|
|
16
|
+
const oauth_handlers_ts_1 = require("./oauth-handlers.js");
|
|
8
17
|
const assert_ts_1 = require("assert-ts");
|
|
9
18
|
const querystring_1 = require("querystring");
|
|
10
19
|
const base64_url_1 = require("base64-url");
|
|
11
|
-
const
|
|
20
|
+
const username_password_ts_1 = require("../views/username-password.js");
|
|
12
21
|
const jsonwebtoken_1 = require("jsonwebtoken");
|
|
13
|
-
const
|
|
22
|
+
const utils_ts_1 = require("./utils.js");
|
|
14
23
|
const createLogger = (debug) => ({
|
|
15
24
|
log: (...args) => {
|
|
16
25
|
if (!debug) {
|
|
17
26
|
return;
|
|
18
27
|
}
|
|
19
28
|
console.dir(...args);
|
|
20
|
-
}
|
|
29
|
+
},
|
|
21
30
|
});
|
|
22
|
-
const createAuth0Handlers = (
|
|
31
|
+
const createAuth0Handlers = (simulationStore, serviceURL, options, debug) => {
|
|
23
32
|
let { audience, scope, clientID, rulesDirectory } = options;
|
|
24
|
-
let personQuery = (0,
|
|
33
|
+
let personQuery = (0, utils_ts_1.createPersonQuery)(simulationStore);
|
|
25
34
|
let authorizeHandlers = {
|
|
26
|
-
query: (0,
|
|
27
|
-
web_message: (0,
|
|
35
|
+
query: (0, login_redirect_ts_1.createLoginRedirectHandler)(options),
|
|
36
|
+
web_message: (0, web_message_ts_1.createWebMessageHandler)(),
|
|
28
37
|
};
|
|
29
38
|
let logger = createLogger(debug);
|
|
30
39
|
return {
|
|
31
|
-
[
|
|
40
|
+
["/heartbeat"]: function (_, res) {
|
|
32
41
|
res.status(200).json({ ok: true });
|
|
33
42
|
},
|
|
34
|
-
[
|
|
43
|
+
["/authorize"]: function (req, res, next) {
|
|
35
44
|
var _a;
|
|
36
|
-
logger.log({
|
|
45
|
+
logger.log({
|
|
46
|
+
"/authorize": {
|
|
47
|
+
body: req.body,
|
|
48
|
+
query: req.query,
|
|
49
|
+
session: req.session,
|
|
50
|
+
},
|
|
51
|
+
});
|
|
37
52
|
let currentUser = req.query.currentUser;
|
|
38
53
|
(0, assert_ts_1.assert)(!!req.session, "no session");
|
|
39
54
|
if (currentUser) {
|
|
@@ -42,119 +57,130 @@ const createAuth0Handlers = (store, people, serviceURL, options, debug) => {
|
|
|
42
57
|
// adding the user to the session
|
|
43
58
|
req.session.username = currentUser;
|
|
44
59
|
}
|
|
45
|
-
let responseMode = ((_a = req.query.response_mode) !== null && _a !== void 0 ? _a :
|
|
46
|
-
(0, assert_ts_1.assert)([
|
|
60
|
+
let responseMode = ((_a = req.query.response_mode) !== null && _a !== void 0 ? _a : "query");
|
|
61
|
+
(0, assert_ts_1.assert)(["query", "web_message"].includes(responseMode), `unknown response_mode ${responseMode}`);
|
|
47
62
|
let handler = authorizeHandlers[responseMode];
|
|
48
63
|
handler(req, res, next);
|
|
49
64
|
},
|
|
50
|
-
[
|
|
65
|
+
["/login"]: function (req, res) {
|
|
51
66
|
var _a, _b;
|
|
52
|
-
logger.log({
|
|
67
|
+
logger.log({ "/login": { body: req.body, query: req.query } });
|
|
53
68
|
let query = req.query;
|
|
54
69
|
let responseClientId = (_a = query.client_id) !== null && _a !== void 0 ? _a : clientID;
|
|
55
70
|
let responseAudience = (_b = query.audience) !== null && _b !== void 0 ? _b : audience;
|
|
56
71
|
(0, assert_ts_1.assert)(!!responseClientId, `no clientID assigned`);
|
|
57
|
-
let html = (0,
|
|
58
|
-
domain: serviceURL().host,
|
|
72
|
+
let html = (0, login_ts_1.loginView)({
|
|
73
|
+
domain: new URL(serviceURL(req)).host,
|
|
59
74
|
scope,
|
|
60
75
|
redirectUri: query.redirect_uri,
|
|
61
76
|
clientID: responseClientId,
|
|
62
77
|
audience: responseAudience,
|
|
63
|
-
loginFailed: false
|
|
78
|
+
loginFailed: false,
|
|
64
79
|
});
|
|
65
80
|
res.set("Content-Type", "text/html");
|
|
66
81
|
res.status(200).send(Buffer.from(html));
|
|
67
82
|
},
|
|
68
|
-
[
|
|
83
|
+
["/usernamepassword/login"]: function (req, res) {
|
|
69
84
|
var _a, _b;
|
|
70
|
-
logger.log({
|
|
85
|
+
logger.log({
|
|
86
|
+
"/usernamepassword/login": { body: req.body, query: req.query },
|
|
87
|
+
});
|
|
71
88
|
let { username, nonce, password } = req.body;
|
|
72
|
-
(0, assert_ts_1.assert)(!!username,
|
|
73
|
-
(0, assert_ts_1.assert)(!!nonce,
|
|
89
|
+
(0, assert_ts_1.assert)(!!username, "no username in /usernamepassword/login");
|
|
90
|
+
(0, assert_ts_1.assert)(!!nonce, "no nonce in /usernamepassword/login");
|
|
74
91
|
(0, assert_ts_1.assert)(!!req.session, "no session");
|
|
75
|
-
let user = personQuery((person) => {
|
|
92
|
+
let user = personQuery((person) => {
|
|
93
|
+
var _a;
|
|
94
|
+
return ((_a = person.email) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === username.toLowerCase() &&
|
|
95
|
+
person.password === password;
|
|
96
|
+
});
|
|
76
97
|
if (!user) {
|
|
77
98
|
let query = req.query;
|
|
78
99
|
let responseClientId = (_a = query.client_id) !== null && _a !== void 0 ? _a : clientID;
|
|
79
100
|
let responseAudience = (_b = query.audience) !== null && _b !== void 0 ? _b : audience;
|
|
80
101
|
(0, assert_ts_1.assert)(!!clientID, `no clientID assigned`);
|
|
81
|
-
let html = (0,
|
|
82
|
-
domain: serviceURL().host,
|
|
102
|
+
let html = (0, login_ts_1.loginView)({
|
|
103
|
+
domain: new URL(serviceURL(req)).host,
|
|
83
104
|
scope,
|
|
84
105
|
redirectUri: query.redirect_uri,
|
|
85
106
|
clientID: responseClientId,
|
|
86
107
|
audience: responseAudience,
|
|
87
|
-
loginFailed: true
|
|
108
|
+
loginFailed: true,
|
|
88
109
|
});
|
|
89
110
|
res.set("Content-Type", "text/html");
|
|
90
111
|
res.status(400).send(html);
|
|
91
112
|
return;
|
|
92
113
|
}
|
|
93
114
|
req.session.username = username;
|
|
94
|
-
store.
|
|
95
|
-
|
|
115
|
+
simulationStore.store.dispatch(simulationStore.actions.batchUpdater([
|
|
116
|
+
simulationStore.schema.sessions.patch({
|
|
117
|
+
[nonce]: { username, nonce },
|
|
118
|
+
}),
|
|
119
|
+
]));
|
|
120
|
+
res.status(200).send((0, username_password_ts_1.userNamePasswordForm)(req.body));
|
|
96
121
|
},
|
|
97
|
-
[
|
|
122
|
+
["/login/callback"]: function (req, res) {
|
|
98
123
|
let wctx = JSON.parse(req.body.wctx);
|
|
99
|
-
logger.log({
|
|
124
|
+
logger.log({
|
|
125
|
+
"/login/callback": { body: req.body, query: req.query, wctx },
|
|
126
|
+
});
|
|
100
127
|
let { redirect_uri, nonce } = wctx;
|
|
101
|
-
|
|
128
|
+
const session = simulationStore.schema.sessions.selectById(simulationStore.store.getState(), { id: nonce });
|
|
129
|
+
const { username } = session !== null && session !== void 0 ? session : {};
|
|
102
130
|
let encodedNonce = (0, base64_url_1.encode)(`${nonce}:${username}`);
|
|
103
|
-
let qs = (0, querystring_1.stringify)({ code: encodedNonce,
|
|
131
|
+
let qs = (0, querystring_1.stringify)(Object.assign({ code: encodedNonce }, wctx));
|
|
104
132
|
let routerUrl = `${redirect_uri}?${qs}`;
|
|
105
133
|
res.status(302).redirect(routerUrl);
|
|
106
134
|
},
|
|
107
|
-
[
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
next(error);
|
|
132
|
-
}
|
|
135
|
+
["/oauth/token"]: function (req, res, next) {
|
|
136
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
137
|
+
var _a, _b, _c, _d;
|
|
138
|
+
logger.log({ "/oauth/token": { body: req.body, query: req.query } });
|
|
139
|
+
try {
|
|
140
|
+
let iss = serviceURL(req);
|
|
141
|
+
let responseClientId = (_b = (_a = req === null || req === void 0 ? void 0 : req.body) === null || _a === void 0 ? void 0 : _a.client_id) !== null && _b !== void 0 ? _b : clientID;
|
|
142
|
+
let responseAudience = (_d = (_c = req === null || req === void 0 ? void 0 : req.body) === null || _c === void 0 ? void 0 : _c.audience) !== null && _d !== void 0 ? _d : audience;
|
|
143
|
+
(0, assert_ts_1.assert)(!!responseClientId, "500::no clientID in options or request body");
|
|
144
|
+
let tokens = yield (0, oauth_handlers_ts_1.createTokens)({
|
|
145
|
+
simulationStore,
|
|
146
|
+
body: req.body,
|
|
147
|
+
iss,
|
|
148
|
+
clientID: responseClientId,
|
|
149
|
+
audience: responseAudience,
|
|
150
|
+
rulesDirectory,
|
|
151
|
+
scope,
|
|
152
|
+
});
|
|
153
|
+
res.status(200).json(Object.assign(Object.assign({}, tokens), { expires_in: 86400, token_type: "Bearer" }));
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
next(error);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
133
159
|
},
|
|
134
|
-
[
|
|
160
|
+
["/v2/logout"]: function (req, res) {
|
|
135
161
|
var _a;
|
|
136
162
|
req.session = null;
|
|
137
163
|
let returnToUrl = (_a = req.query.returnTo) !== null && _a !== void 0 ? _a : req.headers.referer;
|
|
138
|
-
(0, assert_ts_1.assert)(typeof returnToUrl ===
|
|
164
|
+
(0, assert_ts_1.assert)(typeof returnToUrl === "string", `no logical returnTo url`);
|
|
139
165
|
res.redirect(returnToUrl);
|
|
140
166
|
},
|
|
141
|
-
[
|
|
167
|
+
["/userinfo"]: function (req, res) {
|
|
142
168
|
var _a, _b;
|
|
143
169
|
let token = null;
|
|
144
170
|
if (req.headers.authorization) {
|
|
145
171
|
let authorizationHeader = req.headers.authorization;
|
|
146
|
-
token = (_a = authorizationHeader === null || authorizationHeader === void 0 ? void 0 : authorizationHeader.split(
|
|
172
|
+
token = (_a = authorizationHeader === null || authorizationHeader === void 0 ? void 0 : authorizationHeader.split(" ")) === null || _a === void 0 ? void 0 : _a[1];
|
|
147
173
|
}
|
|
148
174
|
else {
|
|
149
175
|
token = (_b = req === null || req === void 0 ? void 0 : req.query) === null || _b === void 0 ? void 0 : _b.access_token;
|
|
150
176
|
}
|
|
151
|
-
(0, assert_ts_1.assert)(!!token,
|
|
177
|
+
(0, assert_ts_1.assert)(!!token, "no authorization header or access_token");
|
|
152
178
|
let { sub } = (0, jsonwebtoken_1.decode)(token, { json: true });
|
|
153
179
|
let user = personQuery((person) => {
|
|
154
180
|
(0, assert_ts_1.assert)(!!person.id, `no email defined on person scenario`);
|
|
155
181
|
return person.id === sub;
|
|
156
182
|
});
|
|
157
|
-
(0, assert_ts_1.assert)(!!user,
|
|
183
|
+
(0, assert_ts_1.assert)(!!user, "no user in /userinfo");
|
|
158
184
|
let userinfo = {
|
|
159
185
|
sub,
|
|
160
186
|
name: user.name,
|
|
@@ -162,11 +188,11 @@ const createAuth0Handlers = (store, people, serviceURL, options, debug) => {
|
|
|
162
188
|
family_name: user.name,
|
|
163
189
|
email: user.email,
|
|
164
190
|
email_verified: true,
|
|
165
|
-
locale:
|
|
166
|
-
hd:
|
|
191
|
+
locale: "en",
|
|
192
|
+
hd: "okta.com",
|
|
167
193
|
};
|
|
168
194
|
res.status(200).json(userinfo);
|
|
169
|
-
}
|
|
195
|
+
},
|
|
170
196
|
};
|
|
171
197
|
};
|
|
172
198
|
exports.createAuth0Handlers = createAuth0Handlers;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth0-handlers.js","sourceRoot":"","sources":["../../src/handlers/auth0-handlers.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"auth0-handlers.js","sourceRoot":"","sources":["../../src/handlers/auth0-handlers.ts"],"names":[],"mappings":";;;;;;;;;;;;AAOA,2DAAiE;AACjE,qDAA2D;AAC3D,gDAA8C;AAC9C,2DAAmD;AACnD,yCAAmC;AACnC,6CAAwC;AACxC,2CAAoC;AACpC,wEAAqE;AACrE,+CAAqD;AACrD,yCAA+C;AAgB/C,MAAM,YAA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,KAAK,EAAE,yCAAyC,CAAC,CAAC;YAC3D,IAAI,EAAE,GAAG,EAAE,GAAG,IAAA,qBAAW,EAAC,KAAK,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAoB,CAAC;YAEpE,IAAI,IAAI,GAAG,WAAW,CAAC,CAAC,MAAM,EAAE,EAAE;gBAChC,IAAA,kBAAM,EAAC,CAAC,CAAC,MAAM,CAAC,EAAE,EAAE,qCAAqC,CAAC,CAAC;gBAE3D,OAAO,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC;YAC3B,CAAC,CAAC,CAAC;YAEH,IAAA,kBAAM,EAAC,CAAC,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;YAEvC,IAAI,QAAQ,GAAG;gBACb,GAAG;gBACH,IAAI,EAAE,IAAI,CAAC,IAAI;gBACf,UAAU,EAAE,IAAI,CAAC,IAAI;gBACrB,WAAW,EAAE,IAAI,CAAC,IAAI;gBACtB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,cAAc,EAAE,IAAI;gBACpB,MAAM,EAAE,IAAI;gBACZ,EAAE,EAAE,UAAU;aACf,CAAC;YAEF,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACjC,CAAC;KACF,CAAC;AACJ,CAAC,CAAC;AAnOW,QAAA,mBAAmB,uBAmO9B"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type Express } from "express";
|
|
2
|
+
import type { ExtendedSimulationStore } from "../store/index.ts";
|
|
3
|
+
import { Auth0Configuration } from "../types.ts";
|
|
4
|
+
export declare const extendRouter: (config: Auth0Configuration, debug?: boolean) => (router: Express, simulationStore: ExtendedSimulationStore) => void;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":"AAAA,OAAgB,EAAgB,KAAK,OAAO,EAAE,MAAM,SAAS,CAAC;AAC9D,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAQjE,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGjD,eAAO,MAAM,YAAY,GACtB,QAAQ,kBAAkB,EAAE,eAAa,MACzC,QAAQ,OAAO,EAAE,iBAAiB,uBAAuB,SAoCzD,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.extendRouter = void 0;
|
|
7
|
+
const express_1 = __importDefault(require("express"));
|
|
8
|
+
const create_cors_ts_1 = require("../middleware/create-cors.js");
|
|
9
|
+
const no_cache_ts_1 = require("../middleware/no-cache.js");
|
|
10
|
+
const session_ts_1 = require("../middleware/session.js");
|
|
11
|
+
const error_handling_ts_1 = require("../middleware/error-handling.js");
|
|
12
|
+
const auth0_handlers_ts_1 = require("./auth0-handlers.js");
|
|
13
|
+
const openid_handlers_ts_1 = require("./openid-handlers.js");
|
|
14
|
+
const path_1 = __importDefault(require("path"));
|
|
15
|
+
const publicDir = path_1.default.join(__dirname, "..", "views", "public");
|
|
16
|
+
const extendRouter = (config, debug = false) => (router, simulationStore) => {
|
|
17
|
+
const serviceURL = (request) => `${request.protocol}://${request.get("Host")}/`;
|
|
18
|
+
const auth0 = (0, auth0_handlers_ts_1.createAuth0Handlers)(simulationStore, serviceURL, config, debug);
|
|
19
|
+
const openid = (0, openid_handlers_ts_1.createOpenIdHandlers)(serviceURL);
|
|
20
|
+
router
|
|
21
|
+
.use(express_1.default.static(publicDir))
|
|
22
|
+
.use((0, session_ts_1.createSession)())
|
|
23
|
+
.use((0, create_cors_ts_1.createCors)())
|
|
24
|
+
.use((0, no_cache_ts_1.noCache)())
|
|
25
|
+
.get("/health", (_, response) => {
|
|
26
|
+
response.send({ status: "ok" });
|
|
27
|
+
})
|
|
28
|
+
.get("/heartbeat", auth0["/heartbeat"])
|
|
29
|
+
.get("/authorize", auth0["/authorize"])
|
|
30
|
+
.get("/login", auth0["/login"])
|
|
31
|
+
.get("/u/login", auth0["/usernamepassword/login"])
|
|
32
|
+
.post("/usernamepassword/login", auth0["/usernamepassword/login"])
|
|
33
|
+
.post("/login/callback", auth0["/login/callback"])
|
|
34
|
+
.post("/oauth/token", auth0["/oauth/token"])
|
|
35
|
+
.get("/userinfo", auth0["/userinfo"])
|
|
36
|
+
.get("/v2/logout", auth0["/v2/logout"])
|
|
37
|
+
.get("/.well-known/jwks.json", openid["/.well-known/jwks.json"])
|
|
38
|
+
.get("/.well-known/openid-configuration", openid["/.well-known/openid-configuration"]);
|
|
39
|
+
// needs to be the last middleware added
|
|
40
|
+
router.use(error_handling_ts_1.defaultErrorHandler);
|
|
41
|
+
};
|
|
42
|
+
exports.extendRouter = extendRouter;
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/handlers/index.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA8D;AAE9D,iEAA0D;AAC1D,2DAAoD;AACpD,yDAAyD;AACzD,uEAAsE;AACtE,2DAA0D;AAC1D,6DAA4D;AAC5D,gDAAwB;AAGxB,MAAM,SAAS,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,CAAC,CAAC;AACzD,MAAM,YAAY,GACvB,CAAC,MAA0B,EAAE,KAAK,GAAG,KAAK,EAAE,EAAE,CAC9C,CAAC,MAAe,EAAE,eAAwC,EAAE,EAAE;IAC5D,MAAM,UAAU,GAAG,CAAC,OAAgB,EAAE,EAAE,CACtC,GAAG,OAAO,CAAC,QAAQ,MAAM,OAAO,CAAC,GA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C,CAC5C,CAAC;IAEJ,wCAAwC;IACxC,MAAM,CAAC,GAAG,CAAC,uCAAmB,CAAC,CAAC;AAClC,CAAC,CAAC;AAtCS,QAAA,YAAY,gBAsCrB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RequestHandler } from
|
|
2
|
-
import type { Auth0Configuration } from
|
|
1
|
+
import type { RequestHandler } from "express";
|
|
2
|
+
import type { Auth0Configuration } from "../types.ts";
|
|
3
3
|
export declare const createLoginRedirectHandler: (options: Auth0Configuration) => RequestHandler;
|
|
4
4
|
//# sourceMappingURL=login-redirect.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-redirect.d.ts","sourceRoot":"","sources":["../../src/handlers/login-redirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,
|
|
1
|
+
{"version":3,"file":"login-redirect.d.ts","sourceRoot":"","sources":["../../src/handlers/login-redirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAqB,cAAc,EAAE,MAAM,SAAS,CAAC;AACjE,OAAO,KAAK,EAAE,kBAAkB,EAAe,MAAM,aAAa,CAAC;AAGnE,eAAO,MAAM,0BAA0B,GACrC,SAAS,kBAAkB,KAC1B,cAgCA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-redirect.js","sourceRoot":"","sources":["../../src/handlers/login-redirect.ts"],"names":[],"mappings":";;;AAEA,6CAAwC;AAEjC,MAAM,0BAA0B,GAAG,
|
|
1
|
+
{"version":3,"file":"login-redirect.js","sourceRoot":"","sources":["../../src/handlers/login-redirect.ts"],"names":[],"mappings":";;;AAEA,6CAAwC;AAEjC,MAAM,0BAA0B,GAAG,CACxC,OAA2B,EACX,EAAE,CAClB,SAAS,aAAa,CAAC,GAAY,EAAE,GAAa;IAChD,IAAI,EACF,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,KAAK,EACL,KAAK,EACL,KAAK,EACL,aAAa,EACb,cAAc,EACd,qBAAqB,EACrB,WAAW,EACX,aAAa,GACd,GAAG,GAAG,CAAC,KAAoB,CAAC;IAE7B,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,QAAQ,CACtB,UAAU,IAAA,uBAAS,EAAC;QAClB,KAAK;QACL,YAAY;QACZ,MAAM,EAAE,SAAS,IAAI,OAAO,CAAC,QAAQ;QACrC,QAAQ,EAAE,QAAQ;QAClB,KAAK;QACL,aAAa;QACb,aAAa;QACb,KAAK;QACL,cAAc;QACd,qBAAqB;QACrB,WAAW;QACX,QAAQ,EAAE,QAAQ,IAAI,OAAO,CAAC,QAAQ;KACvC,CAAC,EAAE,CACL,CAAC;AACJ,CAAC,CAAC;AAlCS,QAAA,0BAA0B,8BAkCnC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import type { Request } from
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import type { Request } from "express";
|
|
2
|
+
import type { RuleUser } from "../rules/types.ts";
|
|
3
|
+
import type { ScopeConfig, AccessTokenPayload, IdTokenData } from "../types.ts";
|
|
4
|
+
import { ExtendedSimulationStore } from "../store/index.ts";
|
|
5
|
+
import { Auth0User } from "../store/entities.ts";
|
|
6
|
+
export declare const createTokens: ({ body, iss, clientID, audience, rulesDirectory, scope: scopeConfig, simulationStore, }: {
|
|
7
|
+
body: Request["body"];
|
|
7
8
|
iss: string;
|
|
8
9
|
clientID: string;
|
|
9
10
|
audience: string;
|
|
10
11
|
rulesDirectory: string | undefined;
|
|
11
|
-
people: Iterable<Person>;
|
|
12
12
|
scope: ScopeConfig;
|
|
13
|
+
simulationStore: ExtendedSimulationStore;
|
|
13
14
|
}) => Promise<{
|
|
14
15
|
access_token: string;
|
|
15
16
|
id_token?: undefined;
|
|
@@ -20,9 +21,9 @@ export declare const createTokens: ({ body, iss, clientID, audience, rulesDirect
|
|
|
20
21
|
refresh_token: string | undefined;
|
|
21
22
|
}>;
|
|
22
23
|
export declare const getIdToken: ({ body, iss, user, clientID, nonce, }: {
|
|
23
|
-
body: Request[
|
|
24
|
+
body: Request["body"];
|
|
24
25
|
iss: string;
|
|
25
|
-
user:
|
|
26
|
+
user: Auth0User;
|
|
26
27
|
clientID: string;
|
|
27
28
|
nonce: string | undefined;
|
|
28
29
|
}) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/oauth-handlers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"oauth-handlers.d.ts","sourceRoot":"","sources":["../../src/handlers/oauth-handlers.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAe,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC/D,OAAO,KAAK,EACV,WAAW,EACX,kBAAkB,EAElB,WAAW,EAEZ,MAAM,aAAa,CAAC;AAKrB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,eAAO,MAAM,YAAY,GAAU,yFAQhC;IACD,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IACtB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,KAAK,EAAE,WAAW,CAAC;IACnB,eAAe,EAAE,uBAAuB,CAAC;CAC1C;;;;;;;;EAwEA,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,uCAMxB;IACD,IA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