@auth0/auth0-express 1.0.0-beta.2 → 1.0.0-beta.3
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 +1 -0
- package/dist/app-base-url.d.ts.map +1 -1
- package/dist/app-base-url.js +5 -1
- package/dist/app-base-url.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +4 -0
- package/dist/config.js.map +1 -1
- package/dist/handlers/callback-handler.d.ts.map +1 -1
- package/dist/handlers/callback-handler.js +12 -0
- package/dist/handlers/callback-handler.js.map +1 -1
- package/dist/handlers/login-handler.d.ts.map +1 -1
- package/dist/handlers/login-handler.js +19 -0
- package/dist/handlers/login-handler.js.map +1 -1
- package/dist/handlers/logout-handler.d.ts.map +1 -1
- package/dist/handlers/logout-handler.js +8 -1
- package/dist/handlers/logout-handler.js.map +1 -1
- package/dist/handlers/start-enterprise-login.d.ts +21 -0
- package/dist/handlers/start-enterprise-login.d.ts.map +1 -0
- package/dist/handlers/start-enterprise-login.js +26 -0
- package/dist/handlers/start-enterprise-login.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/middleware/require-auth.d.ts +4 -0
- package/dist/middleware/require-auth.d.ts.map +1 -1
- package/dist/middleware/require-auth.js +4 -0
- package/dist/middleware/require-auth.js.map +1 -1
- package/dist/migration/index.d.ts +5 -0
- package/dist/migration/index.d.ts.map +1 -0
- package/dist/migration/index.js +3 -0
- package/dist/migration/index.js.map +1 -0
- package/dist/store/express-oidc-hkdf.d.ts +2 -0
- package/dist/store/express-oidc-hkdf.d.ts.map +1 -0
- package/dist/store/express-oidc-hkdf.js +11 -0
- package/dist/store/express-oidc-hkdf.js.map +1 -0
- package/dist/store/legacy-compatible-stateful-state-store.d.ts +139 -0
- package/dist/store/legacy-compatible-stateful-state-store.d.ts.map +1 -0
- package/dist/store/legacy-compatible-stateful-state-store.js +234 -0
- package/dist/store/legacy-compatible-stateful-state-store.js.map +1 -0
- package/dist/store/legacy-compatible-stateless-state-store.d.ts +82 -0
- package/dist/store/legacy-compatible-stateless-state-store.d.ts.map +1 -0
- package/dist/store/legacy-compatible-stateless-state-store.js +135 -0
- package/dist/store/legacy-compatible-stateless-state-store.js.map +1 -0
- package/dist/store/legacy-session-transformer.d.ts +67 -0
- package/dist/store/legacy-session-transformer.d.ts.map +1 -0
- package/dist/store/legacy-session-transformer.js +118 -0
- package/dist/store/legacy-session-transformer.js.map +1 -0
- package/dist/types.d.ts +67 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +50 -10
- package/dist/utils.js.map +1 -1
- package/package.json +14 -7
package/README.md
CHANGED
|
@@ -32,6 +32,7 @@ Jump straight to the capability you need.
|
|
|
32
32
|
| [Call an API (`getAccessToken`)](#requesting-an-access-token-to-call-an-api) | Get an access token to call APIs as the user |
|
|
33
33
|
| [Authorization with claims](./EXAMPLES.md#authorization-with-claims) | Restrict routes with `claimEquals`, `claimIncludes`, `claimCheck` |
|
|
34
34
|
| [Dynamic app base URLs](./EXAMPLES.md#dynamic-application-base-urls) | Infer the base URL per host or use an allow-list |
|
|
35
|
+
| [Enterprise Connect](./EXAMPLES.md#enterprise-connect) | Use Auth0 as a pure SSO relay while your app owns the session |
|
|
35
36
|
| [Multiple Custom Domains (MCD)](./EXAMPLES.md#multiple-custom-domains-mcd) | Resolve the Auth0 domain per request |
|
|
36
37
|
| [Custom `fetch`](./EXAMPLES.md#configuring-a-customfetch-implementation) | Swap in your own fetch (proxies, retries, instrumentation) |
|
|
37
38
|
| [Discovery cache](./EXAMPLES.md#discovery-cache) | Control caching of OIDC discovery metadata |
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-base-url.d.ts","sourceRoot":"","sources":["../src/app-base-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO5C;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"app-base-url.d.ts","sourceRoot":"","sources":["../src/app-base-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAKvC;;GAEG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAO5C;AA2BD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAgBnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,OAAO,GAAG,MAAM,CAyClG"}
|
package/dist/app-base-url.js
CHANGED
|
@@ -53,7 +53,11 @@ export function inferBaseUrlFromRequest(req) {
|
|
|
53
53
|
const forwardedHost = trusted ? getFirstHeaderValue(req.headers['x-forwarded-host']) : undefined;
|
|
54
54
|
const host = forwardedHost || getFirstHeaderValue(req.headers['host']);
|
|
55
55
|
const proto = req.protocol;
|
|
56
|
-
|
|
56
|
+
// Reject hosts containing userinfo (`@`). A value like `legitimate.com@evil.com`
|
|
57
|
+
// is parsed by the URL constructor as userinfo `legitimate.com` with origin
|
|
58
|
+
// `evil.com`, which would let an attacker smuggle an attacker-controlled origin
|
|
59
|
+
// past the origin checks that consume this base URL.
|
|
60
|
+
if (!host || !proto || host.includes('@')) {
|
|
57
61
|
return null;
|
|
58
62
|
}
|
|
59
63
|
const candidate = `${proto}://${host}`;
|
package/dist/app-base-url.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-base-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BAAgB,SAAS,CAAC,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,YAAY,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AA6E/C;;;;;;;;;;;GAWG;AACH,wBAAgB,SAAS,CAAC,MAAM,GAAE,OAAO,CAAC,YAAY,CAAM,GAAG,YAAY,CAiD1E"}
|
package/dist/config.js
CHANGED
|
@@ -97,6 +97,10 @@ export function getConfig(config = {}) {
|
|
|
97
97
|
throw new MissingRequiredArgumentError('sessionSecret');
|
|
98
98
|
}
|
|
99
99
|
enforceSecureCookies(mergedConfig);
|
|
100
|
+
if (mergedConfig.enterpriseConnect && !mergedConfig.onCallback) {
|
|
101
|
+
throw new InvalidConfigurationError('`onCallback` is required when `enterpriseConnect: true`. ' +
|
|
102
|
+
'Write your own session inside the hook and call res.redirect().');
|
|
103
|
+
}
|
|
100
104
|
return mergedConfig;
|
|
101
105
|
}
|
|
102
106
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,wBAAwB,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAE9D,SAAS,aAAa,CAAC,GAAuB;IAC5C,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;AACrD,CAAC;AASD,SAAS,sBAAsB,CAAC,KAAyB;IACvD,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,IAAI,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back-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"callback-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/callback-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAsB,cAAc,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAiCtG"}
|
|
@@ -3,6 +3,18 @@ import { resolveAppBaseUrl } from '../app-base-url.js';
|
|
|
3
3
|
export async function handleCallback(req, res, options) {
|
|
4
4
|
try {
|
|
5
5
|
const appBaseUrl = resolveAppBaseUrl(options.appBaseUrl, req);
|
|
6
|
+
if (options.enterpriseConnect) {
|
|
7
|
+
const result = await req.auth0.client.completeInteractiveLogin(createRouteUrl(req.url, appBaseUrl));
|
|
8
|
+
await options.onCallback(req, res, {
|
|
9
|
+
idTokenClaims: result.idTokenClaims,
|
|
10
|
+
user: result.user,
|
|
11
|
+
appState: result.appState,
|
|
12
|
+
});
|
|
13
|
+
if (!res.headersSent) {
|
|
14
|
+
res.status(500).json({ error: 'callback_not_resolved', message: 'onCallback resolved without ending the response' });
|
|
15
|
+
}
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
6
18
|
const { appState } = await req.auth0.client.completeInteractiveLogin(createRouteUrl(req.url, appBaseUrl));
|
|
7
19
|
res.redirect(appState?.returnTo ?? appBaseUrl);
|
|
8
20
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"callback-handler.js","sourceRoot":"","sources":["../../src/handlers/callback-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa,EAAE,OAAqB;IACrF,IAAI,CAAC;QACH,MAAM,UAAU,GAAG,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAE9D,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,wBAAwB,CAClE,cAAc,CAAC,GAAG,CAAC,GAAG,EAAE,UAAU,CAAC,CACpC,CAAC;QAEF,GAAG,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,IAAI,UAAU,CAAC,CAAC;IACjD,CAAC;IAAC,OAAO,CAAU,EAAE,CAAC;QACpB,uDAAuD;QACvD,MAAM,KAAK,GAAG,CAAQ,CAAC;QAEvB,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,KAAK,EAAE,KAAK,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC,IAAI;YACvC,OAAO,EAAE,KAAK,CAAC,KAAK,EAAE,iBAAiB,IAAI,KAAK,CAAC,OAAO;SACzD,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
1
|
+
{"version":3,"file":"callback-handler.js","sourceRoot":"","sources":["../../src/handlers/callback-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAY,EAAE,GAAa,EAAE,OAAqB;IACrF,IAAI,CAAC;QAC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ACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/login-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"login-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/login-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAG5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AA+D3C,wBAAsB,WAAW,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CA0BnG"}
|
|
@@ -18,7 +18,26 @@ const RESERVED_OAUTH_PARAMS = new Set([
|
|
|
18
18
|
'redirect_uri',
|
|
19
19
|
'nonce',
|
|
20
20
|
'scope',
|
|
21
|
+
// Target-API params are one family: the transaction only records `audience`, so a link
|
|
22
|
+
// supplying an alias (`resource`, etc.) would mint a token for that target while it is stored
|
|
23
|
+
// under our own audience key, and `getAccessToken()` would later hand the app a token minted
|
|
24
|
+
// for someone else's resource. Reserve the whole family, matching auth0-auth-js's denylist.
|
|
21
25
|
'audience',
|
|
26
|
+
'aud',
|
|
27
|
+
'resource',
|
|
28
|
+
'resources',
|
|
29
|
+
'resource_indicator',
|
|
30
|
+
// Request Objects and related params must be SDK/tenant-controlled, not
|
|
31
|
+
// user-supplied via a login link. prompt/login_hint are
|
|
32
|
+
// intentionally NOT reserved — integrators commonly forward them.
|
|
33
|
+
'request',
|
|
34
|
+
'request_uri',
|
|
35
|
+
'id_token_hint',
|
|
36
|
+
'claims',
|
|
37
|
+
'response_mode',
|
|
38
|
+
// Rich Authorization Requests: a crafted link must not be able to inject its own grant
|
|
39
|
+
// details, which an app reading `authorizationDetails` in its callback would then act on.
|
|
40
|
+
'authorization_details',
|
|
22
41
|
]);
|
|
23
42
|
/**
|
|
24
43
|
* Filters out reserved OAuth parameters and any additional disallowed parameters from the input record.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-handler.js","sourceRoot":"","sources":["../../src/handlers/login-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,qEAAqE;AACrE,4EAA4E;AAC5E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/C,WAAW;IACX,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,eAAe;IACf,OAAO;IACP,gBAAgB;IAChB,uBAAuB;IACvB,WAAW;IACX,cAAc;IACd,OAAO;IACP,OAAO;IACP,UAAU;
|
|
1
|
+
{"version":3,"file":"login-handler.js","sourceRoot":"","sources":["../../src/handlers/login-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,qEAAqE;AACrE,4EAA4E;AAC5E,MAAM,WAAW,GAAG,IAAI,GAAG,CAAC;IAC1B,GAAG,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,SAAS,CAAC;IAC/C,WAAW;IACX,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,gFAAgF;AAChF,MAAM,qBAAqB,GAAG,IAAI,GAAG,CAAC;IACpC,eAAe;IACf,OAAO;IACP,gBAAgB;IAChB,uBAAuB;IACvB,WAAW;IACX,c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AC;QAE7D,MAAM,KAAK,GAAG,GAAG,CAAC,KAAgC,CAAC;QACnD,MAAM,iBAAiB,GAAG,KAAK,CAAC,QAA8B,CAAC;QAC/D,MAAM,iBAAiB,GAAG,cAAc,CAAC,iBAAiB,IAAI,GAAG,EAAE,UAAU,CAAC,CAAC;QAE/E,MAAM,gBAAgB,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,qBAAqB,CAAC;YACpE,2BAA2B,EAAE,OAAO,CAAC,2BAA2B;YAChE,QAAQ,EAAE,EAAE,QAAQ,EAAE,iBAAiB,EAAE;YACzC,mBAAmB,EAAE;gBACnB,GAAG,yBAAyB,CAAC,KAAK,EAAE,CAAC,UAAU,CAAC,CAAC;gBACjD,YAAY,EAAE,WAAW,CAAC,QAAQ,EAAE;aACrC;SACF,CAAC,CAAC;QAEH,GAAG,CAAC,QAAQ,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,KAAK,EAAG,KAAe,CAAC,IAAI;YAC5B,OAAO,EAAG,KAAe,CAAC,OAAO;SAClC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/logout-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"logout-handler.d.ts","sourceRoot":"","sources":["../../src/handlers/logout-handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAE5C,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,wBAAsB,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAqBpG"}
|
|
@@ -2,7 +2,14 @@ import { resolveAppBaseUrl } from '../app-base-url.js';
|
|
|
2
2
|
export async function handleLogout(req, res, options) {
|
|
3
3
|
try {
|
|
4
4
|
const returnTo = resolveAppBaseUrl(options.appBaseUrl, req);
|
|
5
|
-
|
|
5
|
+
// In Enterprise Connect mode the mounted route always forces a federated
|
|
6
|
+
// logout so the enterprise IdP session is ended too. In classic mode we
|
|
7
|
+
// forward ?federated=true when the caller asks for it. Any warning about
|
|
8
|
+
// federated=false is emitted by the upstream client.logout(), not here.
|
|
9
|
+
const federated = options.enterpriseConnect || req.query.federated === 'true'
|
|
10
|
+
? { federated: true }
|
|
11
|
+
: {};
|
|
12
|
+
const logoutUrl = await req.auth0.client.logout({ returnTo, ...federated });
|
|
6
13
|
res.redirect(logoutUrl.href);
|
|
7
14
|
}
|
|
8
15
|
catch (error) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logout-handler.js","sourceRoot":"","sources":["../../src/handlers/logout-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAY,EAAE,GAAa,EAAE,OAAqB;IACnF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC5D,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"logout-handler.js","sourceRoot":"","sources":["../../src/handlers/logout-handler.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAGvD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,GAAY,EAAE,GAAa,EAAE,OAAqB;IACnF,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,iBAAiB,CAAC,OAAO,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;QAC5D,yEAAyE;QACzE,wEAAwE;QACxE,yEAAyE;QACzE,wEAAwE;QACxE,MAAM,SAAS,GACb,OAAO,CAAC,iBAAiB,IAAI,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,MAAM;YACzD,CAAC,CAAC,EAAE,SAAS,EAAE,IAAa,EAAE;YAC9B,CAAC,CAAC,EAAE,CAAC;QAET,MAAM,SAAS,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC,CAAC;QAE5E,GAAG,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAC/B,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;YACnB,KAAK,EAAG,KAAe,CAAC,IAAI;YAC5B,OAAO,EAAG,KAAe,CAAC,OAAO;SAClC,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Request, Response } from 'express';
|
|
2
|
+
import type { StartEnterpriseLoginOptions } from '@auth0/auth0-server-js';
|
|
3
|
+
/**
|
|
4
|
+
* Starts an Enterprise Connect login for the email in `options`.
|
|
5
|
+
*
|
|
6
|
+
* The upstream `@auth0/auth0-server-js` client runs WebFinger domain discovery
|
|
7
|
+
* and returns the authorize URL for a federated domain or `null` for a
|
|
8
|
+
* non-federated one (it also degrades transient discovery failures — 429,
|
|
9
|
+
* network errors — to `null` internally, so those never surface here).
|
|
10
|
+
*
|
|
11
|
+
* We intentionally do not swallow errors: any error the client does throw
|
|
12
|
+
* (e.g. misconfiguration, `EnterpriseConnectNotSupportedError`) propagates to
|
|
13
|
+
* the caller so real failures are visible instead of being masked as "not
|
|
14
|
+
* federated".
|
|
15
|
+
*
|
|
16
|
+
* @returns `true` when the domain is federated and the response was redirected
|
|
17
|
+
* to Auth0; `false` when the domain is not federated, so the caller can fall
|
|
18
|
+
* back to its own non-enterprise login.
|
|
19
|
+
*/
|
|
20
|
+
export declare function startEnterpriseLogin(req: Request, res: Response, options: StartEnterpriseLoginOptions): Promise<boolean>;
|
|
21
|
+
//# sourceMappingURL=start-enterprise-login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-enterprise-login.d.ts","sourceRoot":"","sources":["../../src/handlers/start-enterprise-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,wBAAwB,CAAC;AAE1E;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAsB,oBAAoB,CACxC,GAAG,EAAE,OAAO,EACZ,GAAG,EAAE,QAAQ,EACb,OAAO,EAAE,2BAA2B,GACnC,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Starts an Enterprise Connect login for the email in `options`.
|
|
3
|
+
*
|
|
4
|
+
* The upstream `@auth0/auth0-server-js` client runs WebFinger domain discovery
|
|
5
|
+
* and returns the authorize URL for a federated domain or `null` for a
|
|
6
|
+
* non-federated one (it also degrades transient discovery failures — 429,
|
|
7
|
+
* network errors — to `null` internally, so those never surface here).
|
|
8
|
+
*
|
|
9
|
+
* We intentionally do not swallow errors: any error the client does throw
|
|
10
|
+
* (e.g. misconfiguration, `EnterpriseConnectNotSupportedError`) propagates to
|
|
11
|
+
* the caller so real failures are visible instead of being masked as "not
|
|
12
|
+
* federated".
|
|
13
|
+
*
|
|
14
|
+
* @returns `true` when the domain is federated and the response was redirected
|
|
15
|
+
* to Auth0; `false` when the domain is not federated, so the caller can fall
|
|
16
|
+
* back to its own non-enterprise login.
|
|
17
|
+
*/
|
|
18
|
+
export async function startEnterpriseLogin(req, res, options) {
|
|
19
|
+
const authUrl = await req.auth0.client.startEnterpriseLogin(options);
|
|
20
|
+
if (authUrl) {
|
|
21
|
+
res.redirect(authUrl.href);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=start-enterprise-login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"start-enterprise-login.js","sourceRoot":"","sources":["../../src/handlers/start-enterprise-login.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,KAAK,UAAU,oBAAoB,CACxC,GAAY,EACZ,GAAa,EACb,OAAoC;IAEpC,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACrE,IAAI,OAAO,EAAE,CAAC;QACZ,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -8,4 +8,7 @@ export type { ClaimAuthOptions, ClaimCheckFunction } from './middleware/claim-au
|
|
|
8
8
|
export * from './types.js';
|
|
9
9
|
export { InvalidConfigurationError } from './errors/index.js';
|
|
10
10
|
export { resolveAppBaseUrl, isUrl } from './app-base-url.js';
|
|
11
|
+
export { isFederatedDomain, EnterpriseConnectNotSupportedError } from '@auth0/auth0-server-js';
|
|
12
|
+
export type { EnterpriseConnectCallbackHook } from './types.js';
|
|
13
|
+
export { startEnterpriseLogin } from './handlers/start-enterprise-login.js';
|
|
11
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACvF,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,YAAY,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AACvF,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAC/F,YAAY,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -6,4 +6,6 @@ export { claimCheck } from './middleware/claim-check.js';
|
|
|
6
6
|
export * from './types.js';
|
|
7
7
|
export { InvalidConfigurationError } from './errors/index.js';
|
|
8
8
|
export { resolveAppBaseUrl, isUrl } from './app-base-url.js';
|
|
9
|
+
export { isFederatedDomain, EnterpriseConnectNotSupportedError } from '@auth0/auth0-server-js';
|
|
10
|
+
export { startEnterpriseLogin } from './handlers/start-enterprise-login.js';
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAGzD,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,kCAAkC,EAAE,MAAM,wBAAwB,CAAC;AAE/F,OAAO,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC"}
|
|
@@ -39,6 +39,10 @@ export interface RequiresAuthOptions {
|
|
|
39
39
|
* res.send('Admin page');
|
|
40
40
|
* });
|
|
41
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* **Enterprise Connect mode:** Do NOT use `requiresAuth()` when `enterpriseConnect: true`.
|
|
44
|
+
* `getUser()` is blocked in EC mode and will throw `EnterpriseConnectNotSupportedError`.
|
|
45
|
+
* Use your own session middleware (checking your app-owned session cookie) instead.
|
|
42
46
|
*/
|
|
43
47
|
export declare function requiresAuth(options?: RequiresAuthOptions): (req: Request, res: Response, next: NextFunction) => Promise<void | Response<any, Record<string, any>>>;
|
|
44
48
|
//# sourceMappingURL=require-auth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/require-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED
|
|
1
|
+
{"version":3,"file":"require-auth.d.ts","sourceRoot":"","sources":["../../src/middleware/require-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,mBAAmB,IAC1C,KAAK,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,YAAY,wDA4B9D"}
|
|
@@ -26,6 +26,10 @@
|
|
|
26
26
|
* res.send('Admin page');
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
|
+
*
|
|
30
|
+
* **Enterprise Connect mode:** Do NOT use `requiresAuth()` when `enterpriseConnect: true`.
|
|
31
|
+
* `getUser()` is blocked in EC mode and will throw `EnterpriseConnectNotSupportedError`.
|
|
32
|
+
* Use your own session middleware (checking your app-owned session cookie) instead.
|
|
29
33
|
*/
|
|
30
34
|
export function requiresAuth(options) {
|
|
31
35
|
return async (req, res, next) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"require-auth.js","sourceRoot":"","sources":["../../src/middleware/require-auth.ts"],"names":[],"mappings":"AAeA
|
|
1
|
+
{"version":3,"file":"require-auth.js","sourceRoot":"","sources":["../../src/middleware/require-auth.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,UAAU,YAAY,CAAC,OAA6B;IACxD,OAAO,KAAK,EAAE,GAAY,EAAE,GAAa,EAAE,IAAkB,EAAE,EAAE;QAC/D,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YAE9C,IAAI,CAAC,IAAI,EAAE,CAAC;gBACV,wDAAwD;gBACxD,MAAM,WAAW,GAAG,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAEhE,IAAI,WAAW,EAAE,CAAC;oBAChB,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;wBAC1B,KAAK,EAAE,cAAc;wBACrB,OAAO,EAAE,yBAAyB;qBACnC,CAAC,CAAC;gBACL,CAAC;gBAED,qDAAqD;gBACrD,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,GAAG,CAAC,WAAW,CAAC;gBACtD,MAAM,SAAS,GAAG,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,EAAE,KAAK,IAAI,aAAa,CAAC;gBACpF,MAAM,QAAQ,GAAG,GAAG,SAAS,aAAa,kBAAkB,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACzE,OAAO,GAAG,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;YAChC,CAAC;YAED,kCAAkC;YAClC,IAAI,EAAE,CAAC;QACT,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,KAAK,CAAC,CAAC;QACd,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { MigrationStatelessStateStore } from '../store/legacy-compatible-stateless-state-store.js';
|
|
2
|
+
export { MigrationStatefulStateStore } from '../store/legacy-compatible-stateful-state-store.js';
|
|
3
|
+
export type { MigrationStatelessStateStoreOptions } from '../store/legacy-compatible-stateless-state-store.js';
|
|
4
|
+
export type { MigrationStatefulStateStoreOptions } from '../store/legacy-compatible-stateful-state-store.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAC;AACjG,YAAY,EAAE,mCAAmC,EAAE,MAAM,qDAAqD,CAAC;AAC/G,YAAY,EAAE,kCAAkC,EAAE,MAAM,oDAAoD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/migration/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,qDAAqD,CAAC;AACnG,OAAO,EAAE,2BAA2B,EAAE,MAAM,oDAAoD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express-oidc-hkdf.d.ts","sourceRoot":"","sources":["../../src/store/express-oidc-hkdf.ts"],"names":[],"mappings":"AAMA,wBAAsB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAQlG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// HKDF parameters matching express-openid-connect's key derivation (lib/crypto.js).
|
|
2
|
+
// Both encryption ('JWE CEK') and signing ('JWS Cookie Signing') use the same approach.
|
|
3
|
+
const BYTE_LENGTH = 32;
|
|
4
|
+
const DIGEST = 'SHA-256';
|
|
5
|
+
const encoder = new TextEncoder();
|
|
6
|
+
export async function deriveHkdfKey(secret, info) {
|
|
7
|
+
const keyMaterial = await crypto.subtle.importKey('raw', encoder.encode(secret), 'HKDF', false, ['deriveBits']);
|
|
8
|
+
const derivedBits = await crypto.subtle.deriveBits({ name: 'HKDF', hash: DIGEST, info: encoder.encode(info), salt: new Uint8Array(0) }, keyMaterial, BYTE_LENGTH * 8);
|
|
9
|
+
return new Uint8Array(derivedBits);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=express-oidc-hkdf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"express-oidc-hkdf.js","sourceRoot":"","sources":["../../src/store/express-oidc-hkdf.ts"],"names":[],"mappings":"AAAA,oFAAoF;AACpF,wFAAwF;AACxF,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,MAAM,GAAG,SAAS,CAAC;AACzB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,MAAc,EAAE,IAAY;IAC9D,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;IAChH,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,UAAU,CAChD,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,EACnF,WAAW,EACX,WAAW,GAAG,CAAC,CAChB,CAAC;IACF,OAAO,IAAI,UAAU,CAAC,WAA0B,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { StatefulStateStore, SessionConfiguration, type AbstractDataStore } from '@auth0/auth0-server-js';
|
|
2
|
+
import type { CookieHandler, StateData } from '@auth0/auth0-server-js';
|
|
3
|
+
/**
|
|
4
|
+
* Options for {@link MigrationStatefulStateStore}.
|
|
5
|
+
*/
|
|
6
|
+
export interface MigrationStatefulStateStoreOptions {
|
|
7
|
+
/**
|
|
8
|
+
* The secret used by auth0-server-js for encryption.
|
|
9
|
+
*
|
|
10
|
+
* Provide an array to support secret rotation: the first secret encrypts new cookies, while
|
|
11
|
+
* all secrets are tried, in order, when decrypting.
|
|
12
|
+
*/
|
|
13
|
+
secret: string | string[];
|
|
14
|
+
/**
|
|
15
|
+
* The secret(s) that were used by express-openid-connect for signing cookies.
|
|
16
|
+
* Supports key rotation: provide an array to try multiple secrets in order.
|
|
17
|
+
* If not provided, uses the same secret as auth0-server-js.
|
|
18
|
+
*/
|
|
19
|
+
legacySecret?: string | string[];
|
|
20
|
+
/**
|
|
21
|
+
* Mirror of express-openid-connect's `requireSignedSessionStoreCookie`.
|
|
22
|
+
*
|
|
23
|
+
* When `true`, a legacy session-store cookie is only honored if it carries a valid
|
|
24
|
+
* JWS signature (verified against one of {@link legacySecret}); an unsigned cookie
|
|
25
|
+
* or one whose signature does not verify resolves to no session instead of being
|
|
26
|
+
* used verbatim as the store key. Set this when migrating a deployment that ran
|
|
27
|
+
* express-openid-connect with `requireSignedSessionStoreCookie: true`, so the
|
|
28
|
+
* signature remains the required integrity control over the store key.
|
|
29
|
+
*
|
|
30
|
+
* Defaults to `false`, matching express-openid-connect's default.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
requireSignedLegacyCookie?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* The audience to assign to transformed token sets from express-openid-connect sessions.
|
|
37
|
+
*
|
|
38
|
+
* Token sets are looked up by audience, so this must equal the `audience` your app requests
|
|
39
|
+
* (e.g. via `getAccessToken`) or the migrated access token will not be found. The default
|
|
40
|
+
* `'default'` only matches callers that request no audience.
|
|
41
|
+
*
|
|
42
|
+
* Default: 'default'
|
|
43
|
+
*/
|
|
44
|
+
legacyAudience?: string;
|
|
45
|
+
/**
|
|
46
|
+
* The scope to assign to transformed token sets from express-openid-connect sessions.
|
|
47
|
+
* @default 'openid profile email offline_access'
|
|
48
|
+
*/
|
|
49
|
+
legacyScope?: string;
|
|
50
|
+
/**
|
|
51
|
+
* The custom session store (Redis, MongoDB, etc.)
|
|
52
|
+
*/
|
|
53
|
+
store: AbstractDataStore<unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* Session configuration options
|
|
56
|
+
*/
|
|
57
|
+
sessionConfiguration?: SessionConfiguration;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* A server-side (stateful) state store for zero-downtime migration from `express-openid-connect`
|
|
61
|
+
* to `@auth0/auth0-express`.
|
|
62
|
+
*
|
|
63
|
+
* Extends {@link StatefulStateStore} and transparently reads existing
|
|
64
|
+
* `express-openid-connect` sessions from Redis, MongoDB, or any other custom store,
|
|
65
|
+
* converting them to the `auth0-server-js` format so users do not need to re-authenticate
|
|
66
|
+
* during the migration.
|
|
67
|
+
*
|
|
68
|
+
* **How it works:** `express-openid-connect` wraps session data in a `{ header, data, cookie }`
|
|
69
|
+
* envelope and stores a plain or JWS-signed session ID in the cookie. `auth0-server-js` stores
|
|
70
|
+
* {@link StateData} directly and encrypts the session ID in the cookie. This store overrides
|
|
71
|
+
* `decrypt` so the base machinery resolves the session ID from either cookie format, then reads
|
|
72
|
+
* the store by that ID. On `get`, a legacy envelope is transformed into {@link StateData} and
|
|
73
|
+
* immediately written back to the same store key via `set`, upgrading the session in place on
|
|
74
|
+
* first read rather than waiting for the caller's next write. This is what makes backchannel
|
|
75
|
+
* logout (`deleteByLogoutToken`) work for a migrated session right away: the app's store
|
|
76
|
+
* typically needs to index sessions by `sid` to resolve a logout token, and that index is
|
|
77
|
+
* naturally populated by `set`. A login (`removeIfExists=true`) still deletes the old key and
|
|
78
|
+
* rotates to a fresh ID.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```typescript
|
|
82
|
+
* import { MigrationStatefulStateStore } from '@auth0/auth0-express/migration';
|
|
83
|
+
*
|
|
84
|
+
* const store = new MigrationStatefulStateStore(
|
|
85
|
+
* {
|
|
86
|
+
* secret: process.env.SESSION_SECRET,
|
|
87
|
+
* store: redisStore,
|
|
88
|
+
* legacySecret: process.env.SESSION_SECRET, // the secret used by express-openid-connect
|
|
89
|
+
* legacyAudience: 'https://api.example.com',
|
|
90
|
+
* legacyScope: 'openid profile email',
|
|
91
|
+
* },
|
|
92
|
+
* new ExpressCookieHandler()
|
|
93
|
+
* );
|
|
94
|
+
* ```
|
|
95
|
+
*/
|
|
96
|
+
export declare class MigrationStatefulStateStore<TStoreOptions> extends StatefulStateStore<TStoreOptions> {
|
|
97
|
+
#private;
|
|
98
|
+
constructor(options: MigrationStatefulStateStoreOptions, cookieHandler: CookieHandler<TStoreOptions>);
|
|
99
|
+
/**
|
|
100
|
+
* Overrides decrypt() so the base StatefulStateStore machinery can resolve a session ID
|
|
101
|
+
* from BOTH modern and legacy express-openid-connect cookies.
|
|
102
|
+
*
|
|
103
|
+
* The base `getSessionId()` calls `this.decrypt(identifier, cookieValue)` and reads `.id`
|
|
104
|
+
* from the result. A modern auth0-server-js cookie is a compact JWE (exactly 5 dot-separated
|
|
105
|
+
* segments); a legacy cookie is a plain session ID (no dots) or a JWS-signed `<id>.<sig>`
|
|
106
|
+
* (one dot). We route strictly by shape and never cross-resolve: feeding a modern JWE into the
|
|
107
|
+
* legacy resolver would return the raw ciphertext as a "session ID" and orphan the real session
|
|
108
|
+
* (e.g. when the base throws JWTExpired on an expired-but-valid modern cookie). Modern cookies
|
|
109
|
+
* are delegated entirely to `super.decrypt` (preserving the base's expiry/error semantics);
|
|
110
|
+
* legacy cookies are resolved to `{ id }` so read and write operate on the same store key —
|
|
111
|
+
* upgrading the session in place on the first write.
|
|
112
|
+
*
|
|
113
|
+
* Note: routing is by dot-count. A legacy session ID that itself contains dots (only possible
|
|
114
|
+
* with a custom express-openid-connect `genid`) whose signed form reaches exactly 5 segments
|
|
115
|
+
* would be routed to the modern path and fail to resolve, forcing a one-time re-login. The
|
|
116
|
+
* default `genid` (32 hex chars, no dots) is unaffected.
|
|
117
|
+
*/
|
|
118
|
+
protected decrypt<TData>(identifier: string, encryptedStateData: string): Promise<TData | undefined>;
|
|
119
|
+
/**
|
|
120
|
+
* Overrides get() to transform legacy express-openid-connect envelopes into StateData, and
|
|
121
|
+
* eagerly upgrades the session in place by writing the transformed data back immediately.
|
|
122
|
+
*
|
|
123
|
+
* ID resolution (modern or legacy) is handled by the decrypt() override, so this only needs
|
|
124
|
+
* to detect whether the value the base read from the store is a legacy `{ header, data, cookie }`
|
|
125
|
+
* envelope and, if so, transform it. Modern StateData passes through unchanged.
|
|
126
|
+
*
|
|
127
|
+
* Without the eager write, a migrated session would only be upgraded on the caller's next
|
|
128
|
+
* `set()` (e.g. token refresh, claim update) — until then, backchannel logout could not resolve
|
|
129
|
+
* it, since the app's store commonly builds its `sid` index inside `set()`. Writing here trades
|
|
130
|
+
* one extra store write on the session's first read after migration for backchannel logout
|
|
131
|
+
* working immediately, rather than only after some unrelated future write. The write reuses the
|
|
132
|
+
* same store key (`removeIfExists: false`) via the public `set()`, so it goes through the same
|
|
133
|
+
* cookie/session-id resolution as any other write and is a no-op cost-wise for legacy sessions
|
|
134
|
+
* that were about to be written anyway. A second `get()` within the same request re-reads the
|
|
135
|
+
* now-modern payload and skips the transform/write, so this only happens once per session.
|
|
136
|
+
*/
|
|
137
|
+
get(identifier: string, options?: TStoreOptions): Promise<StateData | undefined>;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=legacy-compatible-stateful-state-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacy-compatible-stateful-state-store.d.ts","sourceRoot":"","sources":["../../src/store/legacy-compatible-stateful-state-store.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,KAAK,iBAAiB,EAEvB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKvE;;GAEG;AACH,MAAM,WAAW,kCAAkC;IACjD;;;;;OAKG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEjC;;;;;;;;;;;;;OAaG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,KAAK,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,qBAAa,2BAA2B,CAAC,aAAa,CAAE,SAAQ,kBAAkB,CAAC,aAAa,CAAC;;gBAKnF,OAAO,EAAE,kCAAkC,EAAE,aAAa,EAAE,aAAa,CAAC,aAAa,CAAC;IAwBpG;;;;;;;;;;;;;;;;;;OAkBG;cACsB,OAAO,CAAC,KAAK,EACpC,UAAU,EAAE,MAAM,EAClB,kBAAkB,EAAE,MAAM,GACzB,OAAO,CAAC,KAAK,GAAG,SAAS,CAAC;IAc7B;;;;;;;;;;;;;;;;;OAiBG;IACY,GAAG,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,SAAS,GAAG,SAAS,CAAC;CAuIhG"}
|