@strapi/admin 5.50.2 → 5.51.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/dist/admin/admin/src/pages/Settings/pages/Roles/components/Permissions.js +14 -6
- package/dist/admin/admin/src/pages/Settings/pages/Roles/components/Permissions.js.map +1 -1
- package/dist/admin/admin/src/pages/Settings/pages/Roles/components/Permissions.mjs +14 -6
- package/dist/admin/admin/src/pages/Settings/pages/Roles/components/Permissions.mjs.map +1 -1
- package/dist/admin/admin/src/utils/cookies.js +77 -2
- package/dist/admin/admin/src/utils/cookies.js.map +1 -1
- package/dist/admin/admin/src/utils/cookies.mjs +76 -3
- package/dist/admin/admin/src/utils/cookies.mjs.map +1 -1
- package/dist/admin/shared/utils/auth-cookie-domain.js +41 -0
- package/dist/admin/shared/utils/auth-cookie-domain.js.map +1 -0
- package/dist/admin/shared/utils/auth-cookie-domain.mjs +38 -0
- package/dist/admin/shared/utils/auth-cookie-domain.mjs.map +1 -0
- package/dist/admin/shared/utils/auth-cookie-name.js +2 -2
- package/dist/admin/shared/utils/auth-cookie-name.js.map +1 -1
- package/dist/admin/shared/utils/auth-cookie-name.mjs +2 -2
- package/dist/admin/shared/utils/auth-cookie-name.mjs.map +1 -1
- package/dist/admin/shared/utils/auth-cookie-path.js +39 -0
- package/dist/admin/shared/utils/auth-cookie-path.js.map +1 -0
- package/dist/admin/shared/utils/auth-cookie-path.mjs +36 -0
- package/dist/admin/shared/utils/auth-cookie-path.mjs.map +1 -0
- package/dist/admin/src/utils/cookies.d.ts +21 -0
- package/dist/ee/server/src/controllers/admin.d.ts.map +1 -1
- package/dist/ee/server/src/controllers/authentication-utils/middlewares.d.ts.map +1 -1
- package/dist/ee/server/src/services/auth.d.ts.map +1 -1
- package/dist/ee/server/src/services/user.d.ts.map +1 -1
- package/dist/server/ee/server/src/controllers/admin.js.map +1 -1
- package/dist/server/ee/server/src/controllers/admin.mjs.map +1 -1
- package/dist/server/ee/server/src/controllers/authentication-utils/middlewares.js +9 -3
- package/dist/server/ee/server/src/controllers/authentication-utils/middlewares.js.map +1 -1
- package/dist/server/ee/server/src/controllers/authentication-utils/middlewares.mjs +10 -4
- package/dist/server/ee/server/src/controllers/authentication-utils/middlewares.mjs.map +1 -1
- package/dist/server/ee/server/src/services/auth.js +5 -5
- package/dist/server/ee/server/src/services/auth.js.map +1 -1
- package/dist/server/ee/server/src/services/auth.mjs +5 -5
- package/dist/server/ee/server/src/services/auth.mjs.map +1 -1
- package/dist/server/ee/server/src/services/user.js +1 -0
- package/dist/server/ee/server/src/services/user.js.map +1 -1
- package/dist/server/ee/server/src/services/user.mjs +1 -0
- package/dist/server/ee/server/src/services/user.mjs.map +1 -1
- package/dist/server/server/src/content-types/User.js +6 -0
- package/dist/server/server/src/content-types/User.js.map +1 -1
- package/dist/server/server/src/content-types/User.mjs +6 -0
- package/dist/server/server/src/content-types/User.mjs.map +1 -1
- package/dist/server/server/src/controllers/authentication.js +12 -10
- package/dist/server/server/src/controllers/authentication.js.map +1 -1
- package/dist/server/server/src/controllers/authentication.mjs +10 -8
- package/dist/server/server/src/controllers/authentication.mjs.map +1 -1
- package/dist/server/server/src/routes/serve-admin-panel.js +17 -4
- package/dist/server/server/src/routes/serve-admin-panel.js.map +1 -1
- package/dist/server/server/src/routes/serve-admin-panel.mjs +17 -4
- package/dist/server/server/src/routes/serve-admin-panel.mjs.map +1 -1
- package/dist/server/server/src/services/auth.js +51 -6
- package/dist/server/server/src/services/auth.js.map +1 -1
- package/dist/server/server/src/services/auth.mjs +46 -6
- package/dist/server/server/src/services/auth.mjs.map +1 -1
- package/dist/server/server/src/services/index.js +1 -1
- package/dist/server/server/src/services/index.js.map +1 -1
- package/dist/server/server/src/services/user.js +1 -0
- package/dist/server/server/src/services/user.js.map +1 -1
- package/dist/server/server/src/services/user.mjs +1 -0
- package/dist/server/server/src/services/user.mjs.map +1 -1
- package/dist/server/shared/utils/auth-cookie-domain.js +41 -0
- package/dist/server/shared/utils/auth-cookie-domain.js.map +1 -0
- package/dist/server/shared/utils/auth-cookie-domain.mjs +38 -0
- package/dist/server/shared/utils/auth-cookie-domain.mjs.map +1 -0
- package/dist/server/shared/utils/auth-cookie-name.js +2 -2
- package/dist/server/shared/utils/auth-cookie-name.js.map +1 -1
- package/dist/server/shared/utils/auth-cookie-name.mjs +2 -2
- package/dist/server/shared/utils/auth-cookie-name.mjs.map +1 -1
- package/dist/server/shared/utils/auth-cookie-path.js +39 -0
- package/dist/server/shared/utils/auth-cookie-path.js.map +1 -0
- package/dist/server/shared/utils/auth-cookie-path.mjs +36 -0
- package/dist/server/shared/utils/auth-cookie-path.mjs.map +1 -0
- package/dist/server/shared/utils/session-auth.js +54 -3
- package/dist/server/shared/utils/session-auth.js.map +1 -1
- package/dist/server/shared/utils/session-auth.mjs +51 -4
- package/dist/server/shared/utils/session-auth.mjs.map +1 -1
- package/dist/server/src/content-types/User.d.ts +6 -0
- package/dist/server/src/content-types/User.d.ts.map +1 -1
- package/dist/server/src/content-types/index.d.ts +6 -0
- package/dist/server/src/content-types/index.d.ts.map +1 -1
- package/dist/server/src/controllers/authentication.d.ts.map +1 -1
- package/dist/server/src/domain/user.d.ts +1 -0
- package/dist/server/src/domain/user.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +6 -0
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/routes/serve-admin-panel.d.ts.map +1 -1
- package/dist/server/src/services/auth.d.ts +18 -0
- package/dist/server/src/services/auth.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/user.d.ts.map +1 -1
- package/dist/shared/contracts/shared.d.ts +2 -1
- package/dist/shared/contracts/shared.d.ts.map +1 -1
- package/dist/shared/utils/__tests__/auth-cookie-domain.test.d.ts +1 -0
- package/dist/shared/utils/__tests__/auth-cookie-domain.test.d.ts.map +1 -0
- package/dist/shared/utils/__tests__/auth-cookie-path.test.d.ts +1 -0
- package/dist/shared/utils/__tests__/auth-cookie-path.test.d.ts.map +1 -0
- package/dist/shared/utils/auth-cookie-domain.d.ts +21 -0
- package/dist/shared/utils/auth-cookie-domain.d.ts.map +1 -0
- package/dist/shared/utils/auth-cookie-name.d.ts +1 -1
- package/dist/shared/utils/auth-cookie-name.d.ts.map +1 -1
- package/dist/shared/utils/auth-cookie-path.d.ts +17 -0
- package/dist/shared/utils/auth-cookie-path.d.ts.map +1 -0
- package/dist/shared/utils/session-auth.d.ts +15 -0
- package/dist/shared/utils/session-auth.d.ts.map +1 -1
- package/package.json +8 -8
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Domain attribute of the admin auth (access) token cookie, configurable
|
|
5
|
+
* through `admin.auth.cookie.domain` (falling back to `admin.auth.domain`) so
|
|
6
|
+
* multiple Strapi instances under the same parent domain share, or stay
|
|
7
|
+
* isolated to, the intended host.
|
|
8
|
+
*
|
|
9
|
+
* Browser-safe single source for both sides of the handoff: the admin panel
|
|
10
|
+
* cannot read server config, so the build transports the config value into
|
|
11
|
+
* the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_DOMAIN` variable
|
|
12
|
+
* (see create-build-context.ts in @strapi/strapi); the server resolves the
|
|
13
|
+
* same config at runtime. Changing the domain requires an admin rebuild, like
|
|
14
|
+
* any other admin config change.
|
|
15
|
+
*
|
|
16
|
+
* Defaults to `undefined` (host-only cookie) to match the browser default and
|
|
17
|
+
* the refresh-cookie behaviour in `getRefreshCookieOptions` when no domain is
|
|
18
|
+
* configured. A host-only cookie and a `Domain`-scoped cookie are distinct
|
|
19
|
+
* entries in the browser cookie store, so set and delete must agree on the
|
|
20
|
+
* domain or logout leaves a colliding copy behind.
|
|
21
|
+
*/ const DEFAULT_AUTH_COOKIE_DOMAIN = undefined;
|
|
22
|
+
const isValidCookieDomain = (domain)=>{
|
|
23
|
+
// RFC 6265 domain-av: a host name. No leading dot required, no scheme, no
|
|
24
|
+
// path, no port, and none of the control/attribute-separator characters.
|
|
25
|
+
return !/[\x00-\x1F\x7F;,\s/:]/.test(domain);
|
|
26
|
+
};
|
|
27
|
+
const resolveAuthCookieDomain = (configuredDomain, warn = console.warn)=>{
|
|
28
|
+
const cookieDomain = (configuredDomain || '').trim();
|
|
29
|
+
if (!cookieDomain) {
|
|
30
|
+
return DEFAULT_AUTH_COOKIE_DOMAIN;
|
|
31
|
+
}
|
|
32
|
+
if (!isValidCookieDomain(cookieDomain)) {
|
|
33
|
+
warn(`Ignoring invalid admin auth cookie domain "${cookieDomain}" (must be a bare host name); using a host-only cookie instead.`);
|
|
34
|
+
return DEFAULT_AUTH_COOKIE_DOMAIN;
|
|
35
|
+
}
|
|
36
|
+
return cookieDomain;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
exports.DEFAULT_AUTH_COOKIE_DOMAIN = DEFAULT_AUTH_COOKIE_DOMAIN;
|
|
40
|
+
exports.resolveAuthCookieDomain = resolveAuthCookieDomain;
|
|
41
|
+
//# sourceMappingURL=auth-cookie-domain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-cookie-domain.js","sources":["../../../../shared/utils/auth-cookie-domain.ts"],"sourcesContent":["/**\n * Domain attribute of the admin auth (access) token cookie, configurable\n * through `admin.auth.cookie.domain` (falling back to `admin.auth.domain`) so\n * multiple Strapi instances under the same parent domain share, or stay\n * isolated to, the intended host.\n *\n * Browser-safe single source for both sides of the handoff: the admin panel\n * cannot read server config, so the build transports the config value into\n * the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_DOMAIN` variable\n * (see create-build-context.ts in @strapi/strapi); the server resolves the\n * same config at runtime. Changing the domain requires an admin rebuild, like\n * any other admin config change.\n *\n * Defaults to `undefined` (host-only cookie) to match the browser default and\n * the refresh-cookie behaviour in `getRefreshCookieOptions` when no domain is\n * configured. A host-only cookie and a `Domain`-scoped cookie are distinct\n * entries in the browser cookie store, so set and delete must agree on the\n * domain or logout leaves a colliding copy behind.\n */\nexport const DEFAULT_AUTH_COOKIE_DOMAIN = undefined;\n\nconst isValidCookieDomain = (domain: string): boolean => {\n // RFC 6265 domain-av: a host name. No leading dot required, no scheme, no\n // path, no port, and none of the control/attribute-separator characters.\n return !/[\\x00-\\x1F\\x7F;,\\s/:]/.test(domain);\n};\n\nexport const resolveAuthCookieDomain = (\n configuredDomain?: string,\n warn: (message: string) => void = console.warn\n): string | undefined => {\n const cookieDomain = (configuredDomain || '').trim();\n\n if (!cookieDomain) {\n return DEFAULT_AUTH_COOKIE_DOMAIN;\n }\n\n if (!isValidCookieDomain(cookieDomain)) {\n warn(\n `Ignoring invalid admin auth cookie domain \"${cookieDomain}\" (must be a bare host name); using a host-only cookie instead.`\n );\n return DEFAULT_AUTH_COOKIE_DOMAIN;\n }\n\n return cookieDomain;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_DOMAIN","undefined","isValidCookieDomain","domain","test","resolveAuthCookieDomain","configuredDomain","warn","console","cookieDomain","trim"],"mappings":";;AAAA;;;;;;;;;;;;;;;;;;IAmBO,MAAMA,0BAAAA,GAA6BC;AAE1C,MAAMC,sBAAsB,CAACC,MAAAA,GAAAA;;;IAG3B,OAAO,CAAC,uBAAA,CAAwBC,IAAI,CAACD,MAAAA,CAAAA;AACvC,CAAA;MAEaE,uBAAAA,GAA0B,CACrCC,gBAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,eAAe,CAACH,gBAAAA,IAAoB,EAAC,EAAGI,IAAI,EAAA;AAElD,IAAA,IAAI,CAACD,YAAAA,EAAc;QACjB,OAAOT,0BAAAA;AACT,IAAA;IAEA,IAAI,CAACE,oBAAoBO,YAAAA,CAAAA,EAAe;AACtCF,QAAAA,IAAAA,CACE,CAAC,2CAA2C,EAAEE,YAAAA,CAAa,+DAA+D,CAAC,CAAA;QAE7H,OAAOT,0BAAAA;AACT,IAAA;IAEA,OAAOS,YAAAA;AACT;;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Domain attribute of the admin auth (access) token cookie, configurable
|
|
3
|
+
* through `admin.auth.cookie.domain` (falling back to `admin.auth.domain`) so
|
|
4
|
+
* multiple Strapi instances under the same parent domain share, or stay
|
|
5
|
+
* isolated to, the intended host.
|
|
6
|
+
*
|
|
7
|
+
* Browser-safe single source for both sides of the handoff: the admin panel
|
|
8
|
+
* cannot read server config, so the build transports the config value into
|
|
9
|
+
* the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_DOMAIN` variable
|
|
10
|
+
* (see create-build-context.ts in @strapi/strapi); the server resolves the
|
|
11
|
+
* same config at runtime. Changing the domain requires an admin rebuild, like
|
|
12
|
+
* any other admin config change.
|
|
13
|
+
*
|
|
14
|
+
* Defaults to `undefined` (host-only cookie) to match the browser default and
|
|
15
|
+
* the refresh-cookie behaviour in `getRefreshCookieOptions` when no domain is
|
|
16
|
+
* configured. A host-only cookie and a `Domain`-scoped cookie are distinct
|
|
17
|
+
* entries in the browser cookie store, so set and delete must agree on the
|
|
18
|
+
* domain or logout leaves a colliding copy behind.
|
|
19
|
+
*/ const DEFAULT_AUTH_COOKIE_DOMAIN = undefined;
|
|
20
|
+
const isValidCookieDomain = (domain)=>{
|
|
21
|
+
// RFC 6265 domain-av: a host name. No leading dot required, no scheme, no
|
|
22
|
+
// path, no port, and none of the control/attribute-separator characters.
|
|
23
|
+
return !/[\x00-\x1F\x7F;,\s/:]/.test(domain);
|
|
24
|
+
};
|
|
25
|
+
const resolveAuthCookieDomain = (configuredDomain, warn = console.warn)=>{
|
|
26
|
+
const cookieDomain = (configuredDomain || '').trim();
|
|
27
|
+
if (!cookieDomain) {
|
|
28
|
+
return DEFAULT_AUTH_COOKIE_DOMAIN;
|
|
29
|
+
}
|
|
30
|
+
if (!isValidCookieDomain(cookieDomain)) {
|
|
31
|
+
warn(`Ignoring invalid admin auth cookie domain "${cookieDomain}" (must be a bare host name); using a host-only cookie instead.`);
|
|
32
|
+
return DEFAULT_AUTH_COOKIE_DOMAIN;
|
|
33
|
+
}
|
|
34
|
+
return cookieDomain;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export { DEFAULT_AUTH_COOKIE_DOMAIN, resolveAuthCookieDomain };
|
|
38
|
+
//# sourceMappingURL=auth-cookie-domain.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-cookie-domain.mjs","sources":["../../../../shared/utils/auth-cookie-domain.ts"],"sourcesContent":["/**\n * Domain attribute of the admin auth (access) token cookie, configurable\n * through `admin.auth.cookie.domain` (falling back to `admin.auth.domain`) so\n * multiple Strapi instances under the same parent domain share, or stay\n * isolated to, the intended host.\n *\n * Browser-safe single source for both sides of the handoff: the admin panel\n * cannot read server config, so the build transports the config value into\n * the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_DOMAIN` variable\n * (see create-build-context.ts in @strapi/strapi); the server resolves the\n * same config at runtime. Changing the domain requires an admin rebuild, like\n * any other admin config change.\n *\n * Defaults to `undefined` (host-only cookie) to match the browser default and\n * the refresh-cookie behaviour in `getRefreshCookieOptions` when no domain is\n * configured. A host-only cookie and a `Domain`-scoped cookie are distinct\n * entries in the browser cookie store, so set and delete must agree on the\n * domain or logout leaves a colliding copy behind.\n */\nexport const DEFAULT_AUTH_COOKIE_DOMAIN = undefined;\n\nconst isValidCookieDomain = (domain: string): boolean => {\n // RFC 6265 domain-av: a host name. No leading dot required, no scheme, no\n // path, no port, and none of the control/attribute-separator characters.\n return !/[\\x00-\\x1F\\x7F;,\\s/:]/.test(domain);\n};\n\nexport const resolveAuthCookieDomain = (\n configuredDomain?: string,\n warn: (message: string) => void = console.warn\n): string | undefined => {\n const cookieDomain = (configuredDomain || '').trim();\n\n if (!cookieDomain) {\n return DEFAULT_AUTH_COOKIE_DOMAIN;\n }\n\n if (!isValidCookieDomain(cookieDomain)) {\n warn(\n `Ignoring invalid admin auth cookie domain \"${cookieDomain}\" (must be a bare host name); using a host-only cookie instead.`\n );\n return DEFAULT_AUTH_COOKIE_DOMAIN;\n }\n\n return cookieDomain;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_DOMAIN","undefined","isValidCookieDomain","domain","test","resolveAuthCookieDomain","configuredDomain","warn","console","cookieDomain","trim"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;IAmBO,MAAMA,0BAAAA,GAA6BC;AAE1C,MAAMC,sBAAsB,CAACC,MAAAA,GAAAA;;;IAG3B,OAAO,CAAC,uBAAA,CAAwBC,IAAI,CAACD,MAAAA,CAAAA;AACvC,CAAA;MAEaE,uBAAAA,GAA0B,CACrCC,gBAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,eAAe,CAACH,gBAAAA,IAAoB,EAAC,EAAGI,IAAI,EAAA;AAElD,IAAA,IAAI,CAACD,YAAAA,EAAc;QACjB,OAAOT,0BAAAA;AACT,IAAA;IAEA,IAAI,CAACE,oBAAoBO,YAAAA,CAAAA,EAAe;AACtCF,QAAAA,IAAAA,CACE,CAAC,2CAA2C,EAAEE,YAAAA,CAAa,+DAA+D,CAAC,CAAA;QAE7H,OAAOT,0BAAAA;AACT,IAAA;IAEA,OAAOS,YAAAA;AACT;;;;"}
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
*/ const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';
|
|
15
15
|
// RFC 6265 cookie-name token characters.
|
|
16
16
|
const VALID_COOKIE_NAME = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
17
|
-
const resolveAuthCookieName = (configuredName)=>{
|
|
17
|
+
const resolveAuthCookieName = (configuredName, warn = console.warn)=>{
|
|
18
18
|
const cookieName = (configuredName || '').trim();
|
|
19
19
|
if (!cookieName) {
|
|
20
20
|
return DEFAULT_AUTH_COOKIE_NAME;
|
|
21
21
|
}
|
|
22
22
|
if (!VALID_COOKIE_NAME.test(cookieName)) {
|
|
23
|
-
|
|
23
|
+
warn(`Ignoring invalid admin auth cookie name "${cookieName}" (must only contain RFC 6265 cookie-name characters); using "${DEFAULT_AUTH_COOKIE_NAME}" instead.`);
|
|
24
24
|
return DEFAULT_AUTH_COOKIE_NAME;
|
|
25
25
|
}
|
|
26
26
|
return cookieName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-cookie-name.js","sources":["../../../../shared/utils/auth-cookie-name.ts"],"sourcesContent":["/**\n * Name of the cookie holding the admin auth (access) token, configurable\n * through `admin.auth.cookie.name` so it cannot collide with a same-named\n * cookie set by another application on a shared parent domain.\n *\n * Browser-safe single source for both sides of the SSO handoff: the admin\n * panel cannot read server config, so the build transports the config value\n * into the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_NAME`\n * variable (see create-build-context.ts in @strapi/strapi); the server\n * resolves the same config at runtime. Renaming the cookie requires an admin\n * rebuild, like any other admin config change.\n */\nexport const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';\n\n// RFC 6265 cookie-name token characters.\nconst VALID_COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nexport const resolveAuthCookieName = (configuredName?: string): string => {\n const cookieName = (configuredName || '').trim();\n\n if (!cookieName) {\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n if (!VALID_COOKIE_NAME.test(cookieName)) {\n
|
|
1
|
+
{"version":3,"file":"auth-cookie-name.js","sources":["../../../../shared/utils/auth-cookie-name.ts"],"sourcesContent":["/**\n * Name of the cookie holding the admin auth (access) token, configurable\n * through `admin.auth.cookie.name` so it cannot collide with a same-named\n * cookie set by another application on a shared parent domain.\n *\n * Browser-safe single source for both sides of the SSO handoff: the admin\n * panel cannot read server config, so the build transports the config value\n * into the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_NAME`\n * variable (see create-build-context.ts in @strapi/strapi); the server\n * resolves the same config at runtime. Renaming the cookie requires an admin\n * rebuild, like any other admin config change.\n */\nexport const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';\n\n// RFC 6265 cookie-name token characters.\nconst VALID_COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nexport const resolveAuthCookieName = (\n configuredName?: string,\n warn: (message: string) => void = console.warn\n): string => {\n const cookieName = (configuredName || '').trim();\n\n if (!cookieName) {\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n if (!VALID_COOKIE_NAME.test(cookieName)) {\n warn(\n `Ignoring invalid admin auth cookie name \"${cookieName}\" (must only contain RFC 6265 cookie-name characters); using \"${DEFAULT_AUTH_COOKIE_NAME}\" instead.`\n );\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n return cookieName;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_NAME","VALID_COOKIE_NAME","resolveAuthCookieName","configuredName","warn","console","cookieName","trim","test"],"mappings":";;AAAA;;;;;;;;;;;IAYO,MAAMA,wBAAAA,GAA2B;AAExC;AACA,MAAMC,iBAAAA,GAAoB,gCAAA;MAEbC,qBAAAA,GAAwB,CACnCC,cAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,aAAa,CAACH,cAAAA,IAAkB,EAAC,EAAGI,IAAI,EAAA;AAE9C,IAAA,IAAI,CAACD,UAAAA,EAAY;QACf,OAAON,wBAAAA;AACT,IAAA;AAEA,IAAA,IAAI,CAACC,iBAAAA,CAAkBO,IAAI,CAACF,UAAAA,CAAAA,EAAa;QACvCF,IAAAA,CACE,CAAC,yCAAyC,EAAEE,UAAAA,CAAW,8DAA8D,EAAEN,wBAAAA,CAAyB,UAAU,CAAC,CAAA;QAE7J,OAAOA,wBAAAA;AACT,IAAA;IAEA,OAAOM,UAAAA;AACT;;;;;"}
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
*/ const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';
|
|
13
13
|
// RFC 6265 cookie-name token characters.
|
|
14
14
|
const VALID_COOKIE_NAME = /^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/;
|
|
15
|
-
const resolveAuthCookieName = (configuredName)=>{
|
|
15
|
+
const resolveAuthCookieName = (configuredName, warn = console.warn)=>{
|
|
16
16
|
const cookieName = (configuredName || '').trim();
|
|
17
17
|
if (!cookieName) {
|
|
18
18
|
return DEFAULT_AUTH_COOKIE_NAME;
|
|
19
19
|
}
|
|
20
20
|
if (!VALID_COOKIE_NAME.test(cookieName)) {
|
|
21
|
-
|
|
21
|
+
warn(`Ignoring invalid admin auth cookie name "${cookieName}" (must only contain RFC 6265 cookie-name characters); using "${DEFAULT_AUTH_COOKIE_NAME}" instead.`);
|
|
22
22
|
return DEFAULT_AUTH_COOKIE_NAME;
|
|
23
23
|
}
|
|
24
24
|
return cookieName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auth-cookie-name.mjs","sources":["../../../../shared/utils/auth-cookie-name.ts"],"sourcesContent":["/**\n * Name of the cookie holding the admin auth (access) token, configurable\n * through `admin.auth.cookie.name` so it cannot collide with a same-named\n * cookie set by another application on a shared parent domain.\n *\n * Browser-safe single source for both sides of the SSO handoff: the admin\n * panel cannot read server config, so the build transports the config value\n * into the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_NAME`\n * variable (see create-build-context.ts in @strapi/strapi); the server\n * resolves the same config at runtime. Renaming the cookie requires an admin\n * rebuild, like any other admin config change.\n */\nexport const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';\n\n// RFC 6265 cookie-name token characters.\nconst VALID_COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nexport const resolveAuthCookieName = (configuredName?: string): string => {\n const cookieName = (configuredName || '').trim();\n\n if (!cookieName) {\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n if (!VALID_COOKIE_NAME.test(cookieName)) {\n
|
|
1
|
+
{"version":3,"file":"auth-cookie-name.mjs","sources":["../../../../shared/utils/auth-cookie-name.ts"],"sourcesContent":["/**\n * Name of the cookie holding the admin auth (access) token, configurable\n * through `admin.auth.cookie.name` so it cannot collide with a same-named\n * cookie set by another application on a shared parent domain.\n *\n * Browser-safe single source for both sides of the SSO handoff: the admin\n * panel cannot read server config, so the build transports the config value\n * into the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_NAME`\n * variable (see create-build-context.ts in @strapi/strapi); the server\n * resolves the same config at runtime. Renaming the cookie requires an admin\n * rebuild, like any other admin config change.\n */\nexport const DEFAULT_AUTH_COOKIE_NAME = 'jwtToken';\n\n// RFC 6265 cookie-name token characters.\nconst VALID_COOKIE_NAME = /^[!#$%&'*+\\-.^_`|~0-9A-Za-z]+$/;\n\nexport const resolveAuthCookieName = (\n configuredName?: string,\n warn: (message: string) => void = console.warn\n): string => {\n const cookieName = (configuredName || '').trim();\n\n if (!cookieName) {\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n if (!VALID_COOKIE_NAME.test(cookieName)) {\n warn(\n `Ignoring invalid admin auth cookie name \"${cookieName}\" (must only contain RFC 6265 cookie-name characters); using \"${DEFAULT_AUTH_COOKIE_NAME}\" instead.`\n );\n return DEFAULT_AUTH_COOKIE_NAME;\n }\n\n return cookieName;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_NAME","VALID_COOKIE_NAME","resolveAuthCookieName","configuredName","warn","console","cookieName","trim","test"],"mappings":"AAAA;;;;;;;;;;;IAYO,MAAMA,wBAAAA,GAA2B;AAExC;AACA,MAAMC,iBAAAA,GAAoB,gCAAA;MAEbC,qBAAAA,GAAwB,CACnCC,cAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,aAAa,CAACH,cAAAA,IAAkB,EAAC,EAAGI,IAAI,EAAA;AAE9C,IAAA,IAAI,CAACD,UAAAA,EAAY;QACf,OAAON,wBAAAA;AACT,IAAA;AAEA,IAAA,IAAI,CAACC,iBAAAA,CAAkBO,IAAI,CAACF,UAAAA,CAAAA,EAAa;QACvCF,IAAAA,CACE,CAAC,yCAAyC,EAAEE,UAAAA,CAAW,8DAA8D,EAAEN,wBAAAA,CAAyB,UAAU,CAAC,CAAA;QAE7J,OAAOA,wBAAAA;AACT,IAAA;IAEA,OAAOM,UAAAA;AACT;;;;"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Path attribute of the admin auth (access) token cookie, configurable
|
|
5
|
+
* through `admin.auth.cookie.path` so multiple Strapi instances on the same
|
|
6
|
+
* parent domain can keep separate cookies (e.g. `/strapi-de/admin`).
|
|
7
|
+
*
|
|
8
|
+
* Browser-safe single source for both sides of the handoff: the admin panel
|
|
9
|
+
* cannot read server config, so the build transports the config value into
|
|
10
|
+
* the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_PATH` variable
|
|
11
|
+
* (see create-build-context.ts in @strapi/strapi); the server resolves the
|
|
12
|
+
* same config at runtime. Changing the path requires an admin rebuild, like
|
|
13
|
+
* any other admin config change.
|
|
14
|
+
*
|
|
15
|
+
* Defaults to `/admin` to match the refresh-cookie path used by
|
|
16
|
+
* `getRefreshCookieOptions`.
|
|
17
|
+
*/ const DEFAULT_AUTH_COOKIE_PATH = '/admin';
|
|
18
|
+
const isValidCookiePath = (path)=>{
|
|
19
|
+
if (!path.startsWith('/')) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
// RFC 6265 path-av: any CHAR except CTLs or ";".
|
|
23
|
+
return !/[\x00-\x1F\x7F;]/.test(path);
|
|
24
|
+
};
|
|
25
|
+
const resolveAuthCookiePath = (configuredPath, warn = console.warn)=>{
|
|
26
|
+
const cookiePath = (configuredPath || '').trim();
|
|
27
|
+
if (!cookiePath) {
|
|
28
|
+
return DEFAULT_AUTH_COOKIE_PATH;
|
|
29
|
+
}
|
|
30
|
+
if (!isValidCookiePath(cookiePath)) {
|
|
31
|
+
warn(`Ignoring invalid admin auth cookie path "${cookiePath}" (must be an absolute path without ";"); using "${DEFAULT_AUTH_COOKIE_PATH}" instead.`);
|
|
32
|
+
return DEFAULT_AUTH_COOKIE_PATH;
|
|
33
|
+
}
|
|
34
|
+
return cookiePath;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
exports.DEFAULT_AUTH_COOKIE_PATH = DEFAULT_AUTH_COOKIE_PATH;
|
|
38
|
+
exports.resolveAuthCookiePath = resolveAuthCookiePath;
|
|
39
|
+
//# sourceMappingURL=auth-cookie-path.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-cookie-path.js","sources":["../../../../shared/utils/auth-cookie-path.ts"],"sourcesContent":["/**\n * Path attribute of the admin auth (access) token cookie, configurable\n * through `admin.auth.cookie.path` so multiple Strapi instances on the same\n * parent domain can keep separate cookies (e.g. `/strapi-de/admin`).\n *\n * Browser-safe single source for both sides of the handoff: the admin panel\n * cannot read server config, so the build transports the config value into\n * the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_PATH` variable\n * (see create-build-context.ts in @strapi/strapi); the server resolves the\n * same config at runtime. Changing the path requires an admin rebuild, like\n * any other admin config change.\n *\n * Defaults to `/admin` to match the refresh-cookie path used by\n * `getRefreshCookieOptions`.\n */\nexport const DEFAULT_AUTH_COOKIE_PATH = '/admin';\n\nconst isValidCookiePath = (path: string): boolean => {\n if (!path.startsWith('/')) {\n return false;\n }\n\n // RFC 6265 path-av: any CHAR except CTLs or \";\".\n return !/[\\x00-\\x1F\\x7F;]/.test(path);\n};\n\nexport const resolveAuthCookiePath = (\n configuredPath?: string,\n warn: (message: string) => void = console.warn\n): string => {\n const cookiePath = (configuredPath || '').trim();\n\n if (!cookiePath) {\n return DEFAULT_AUTH_COOKIE_PATH;\n }\n\n if (!isValidCookiePath(cookiePath)) {\n warn(\n `Ignoring invalid admin auth cookie path \"${cookiePath}\" (must be an absolute path without \";\"); using \"${DEFAULT_AUTH_COOKIE_PATH}\" instead.`\n );\n return DEFAULT_AUTH_COOKIE_PATH;\n }\n\n return cookiePath;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_PATH","isValidCookiePath","path","startsWith","test","resolveAuthCookiePath","configuredPath","warn","console","cookiePath","trim"],"mappings":";;AAAA;;;;;;;;;;;;;;IAeO,MAAMA,wBAAAA,GAA2B;AAExC,MAAMC,oBAAoB,CAACC,IAAAA,GAAAA;AACzB,IAAA,IAAI,CAACA,IAAAA,CAAKC,UAAU,CAAC,GAAA,CAAA,EAAM;QACzB,OAAO,KAAA;AACT,IAAA;;IAGA,OAAO,CAAC,kBAAA,CAAmBC,IAAI,CAACF,IAAAA,CAAAA;AAClC,CAAA;MAEaG,qBAAAA,GAAwB,CACnCC,cAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,aAAa,CAACH,cAAAA,IAAkB,EAAC,EAAGI,IAAI,EAAA;AAE9C,IAAA,IAAI,CAACD,UAAAA,EAAY;QACf,OAAOT,wBAAAA;AACT,IAAA;IAEA,IAAI,CAACC,kBAAkBQ,UAAAA,CAAAA,EAAa;QAClCF,IAAAA,CACE,CAAC,yCAAyC,EAAEE,UAAAA,CAAW,iDAAiD,EAAET,wBAAAA,CAAyB,UAAU,CAAC,CAAA;QAEhJ,OAAOA,wBAAAA;AACT,IAAA;IAEA,OAAOS,UAAAA;AACT;;;;;"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Path attribute of the admin auth (access) token cookie, configurable
|
|
3
|
+
* through `admin.auth.cookie.path` so multiple Strapi instances on the same
|
|
4
|
+
* parent domain can keep separate cookies (e.g. `/strapi-de/admin`).
|
|
5
|
+
*
|
|
6
|
+
* Browser-safe single source for both sides of the handoff: the admin panel
|
|
7
|
+
* cannot read server config, so the build transports the config value into
|
|
8
|
+
* the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_PATH` variable
|
|
9
|
+
* (see create-build-context.ts in @strapi/strapi); the server resolves the
|
|
10
|
+
* same config at runtime. Changing the path requires an admin rebuild, like
|
|
11
|
+
* any other admin config change.
|
|
12
|
+
*
|
|
13
|
+
* Defaults to `/admin` to match the refresh-cookie path used by
|
|
14
|
+
* `getRefreshCookieOptions`.
|
|
15
|
+
*/ const DEFAULT_AUTH_COOKIE_PATH = '/admin';
|
|
16
|
+
const isValidCookiePath = (path)=>{
|
|
17
|
+
if (!path.startsWith('/')) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
// RFC 6265 path-av: any CHAR except CTLs or ";".
|
|
21
|
+
return !/[\x00-\x1F\x7F;]/.test(path);
|
|
22
|
+
};
|
|
23
|
+
const resolveAuthCookiePath = (configuredPath, warn = console.warn)=>{
|
|
24
|
+
const cookiePath = (configuredPath || '').trim();
|
|
25
|
+
if (!cookiePath) {
|
|
26
|
+
return DEFAULT_AUTH_COOKIE_PATH;
|
|
27
|
+
}
|
|
28
|
+
if (!isValidCookiePath(cookiePath)) {
|
|
29
|
+
warn(`Ignoring invalid admin auth cookie path "${cookiePath}" (must be an absolute path without ";"); using "${DEFAULT_AUTH_COOKIE_PATH}" instead.`);
|
|
30
|
+
return DEFAULT_AUTH_COOKIE_PATH;
|
|
31
|
+
}
|
|
32
|
+
return cookiePath;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export { DEFAULT_AUTH_COOKIE_PATH, resolveAuthCookiePath };
|
|
36
|
+
//# sourceMappingURL=auth-cookie-path.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-cookie-path.mjs","sources":["../../../../shared/utils/auth-cookie-path.ts"],"sourcesContent":["/**\n * Path attribute of the admin auth (access) token cookie, configurable\n * through `admin.auth.cookie.path` so multiple Strapi instances on the same\n * parent domain can keep separate cookies (e.g. `/strapi-de/admin`).\n *\n * Browser-safe single source for both sides of the handoff: the admin panel\n * cannot read server config, so the build transports the config value into\n * the bundle through the internal `STRAPI_ADMIN_AUTH_COOKIE_PATH` variable\n * (see create-build-context.ts in @strapi/strapi); the server resolves the\n * same config at runtime. Changing the path requires an admin rebuild, like\n * any other admin config change.\n *\n * Defaults to `/admin` to match the refresh-cookie path used by\n * `getRefreshCookieOptions`.\n */\nexport const DEFAULT_AUTH_COOKIE_PATH = '/admin';\n\nconst isValidCookiePath = (path: string): boolean => {\n if (!path.startsWith('/')) {\n return false;\n }\n\n // RFC 6265 path-av: any CHAR except CTLs or \";\".\n return !/[\\x00-\\x1F\\x7F;]/.test(path);\n};\n\nexport const resolveAuthCookiePath = (\n configuredPath?: string,\n warn: (message: string) => void = console.warn\n): string => {\n const cookiePath = (configuredPath || '').trim();\n\n if (!cookiePath) {\n return DEFAULT_AUTH_COOKIE_PATH;\n }\n\n if (!isValidCookiePath(cookiePath)) {\n warn(\n `Ignoring invalid admin auth cookie path \"${cookiePath}\" (must be an absolute path without \";\"); using \"${DEFAULT_AUTH_COOKIE_PATH}\" instead.`\n );\n return DEFAULT_AUTH_COOKIE_PATH;\n }\n\n return cookiePath;\n};\n"],"names":["DEFAULT_AUTH_COOKIE_PATH","isValidCookiePath","path","startsWith","test","resolveAuthCookiePath","configuredPath","warn","console","cookiePath","trim"],"mappings":"AAAA;;;;;;;;;;;;;;IAeO,MAAMA,wBAAAA,GAA2B;AAExC,MAAMC,oBAAoB,CAACC,IAAAA,GAAAA;AACzB,IAAA,IAAI,CAACA,IAAAA,CAAKC,UAAU,CAAC,GAAA,CAAA,EAAM;QACzB,OAAO,KAAA;AACT,IAAA;;IAGA,OAAO,CAAC,kBAAA,CAAmBC,IAAI,CAACF,IAAAA,CAAAA;AAClC,CAAA;MAEaG,qBAAAA,GAAwB,CACnCC,cAAAA,EACAC,IAAAA,GAAkCC,QAAQD,IAAI,GAAA;AAE9C,IAAA,MAAME,aAAa,CAACH,cAAAA,IAAkB,EAAC,EAAGI,IAAI,EAAA;AAE9C,IAAA,IAAI,CAACD,UAAAA,EAAY;QACf,OAAOT,wBAAAA;AACT,IAAA;IAEA,IAAI,CAACC,kBAAkBQ,UAAAA,CAAAA,EAAa;QAClCF,IAAAA,CACE,CAAC,yCAAyC,EAAEE,UAAAA,CAAW,iDAAiD,EAAET,wBAAAA,CAAyB,UAAU,CAAC,CAAA;QAEhJ,OAAOA,wBAAAA;AACT,IAAA;IAEA,OAAOS,UAAAA;AACT;;;;"}
|
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var crypto = require('crypto');
|
|
4
|
+
var utils = require('@strapi/utils');
|
|
4
5
|
var authCookieName = require('./auth-cookie-name.js');
|
|
6
|
+
var authCookiePath = require('./auth-cookie-path.js');
|
|
7
|
+
var authCookieDomain = require('./auth-cookie-domain.js');
|
|
5
8
|
|
|
6
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
7
10
|
|
|
8
11
|
var crypto__default = /*#__PURE__*/_interopDefault(crypto);
|
|
9
12
|
|
|
13
|
+
const ADMIN_ORIGIN = 'admin';
|
|
14
|
+
const SESSION_CONTENT_TYPE = 'admin::session';
|
|
10
15
|
const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';
|
|
16
|
+
// The resolvers are browser-shared (also inlined into the admin bundle) so
|
|
17
|
+
// they default to console.warn; on the server, route their warnings through
|
|
18
|
+
// the Strapi logger instead.
|
|
19
|
+
const warnViaStrapiLog = (message)=>{
|
|
20
|
+
strapi.log.warn(message);
|
|
21
|
+
};
|
|
11
22
|
const getAccessCookieName = ()=>{
|
|
12
23
|
const configured = strapi.config.get('admin.auth.cookie.name');
|
|
13
|
-
return authCookieName.resolveAuthCookieName(configured);
|
|
24
|
+
return authCookieName.resolveAuthCookieName(configured, warnViaStrapiLog);
|
|
25
|
+
};
|
|
26
|
+
const getAccessCookiePath = ()=>{
|
|
27
|
+
const configured = strapi.config.get('admin.auth.cookie.path');
|
|
28
|
+
return authCookiePath.resolveAuthCookiePath(configured, warnViaStrapiLog);
|
|
29
|
+
};
|
|
30
|
+
const getAccessCookieDomain = ()=>{
|
|
31
|
+
const configured = strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');
|
|
32
|
+
return authCookieDomain.resolveAuthCookieDomain(configured, warnViaStrapiLog);
|
|
14
33
|
};
|
|
15
34
|
const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;
|
|
16
35
|
const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;
|
|
@@ -19,8 +38,8 @@ const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;
|
|
|
19
38
|
const getRefreshCookieOptions = (secureRequest)=>{
|
|
20
39
|
const configuredSecure = strapi.config.get('admin.auth.cookie.secure');
|
|
21
40
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
22
|
-
const domain =
|
|
23
|
-
const path =
|
|
41
|
+
const domain = getAccessCookieDomain();
|
|
42
|
+
const path = getAccessCookiePath();
|
|
24
43
|
const sameSite = strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';
|
|
25
44
|
let isSecure;
|
|
26
45
|
if (typeof configuredSecure === 'boolean') {
|
|
@@ -80,6 +99,34 @@ const extractDeviceParams = (requestBody)=>{
|
|
|
80
99
|
rememberMe
|
|
81
100
|
};
|
|
82
101
|
};
|
|
102
|
+
const buildSessionMetadataFromContext = (ctx)=>utils.buildSessionMetadata({
|
|
103
|
+
userAgent: ctx.request.headers['user-agent']
|
|
104
|
+
});
|
|
105
|
+
/**
|
|
106
|
+
* Resolves the device id to use when revoking sessions on logout.
|
|
107
|
+
* SSO assigns deviceId server-side, so the client-provided value may not match
|
|
108
|
+
* the active session row. Prefer the deviceId stored on the session backing
|
|
109
|
+
* the current access token when available.
|
|
110
|
+
*
|
|
111
|
+
* Callers should pass `ctx.state.session.id` from the admin auth strategy and
|
|
112
|
+
* the already-parsed body `deviceId` — the logout route requires authentication,
|
|
113
|
+
* so sessionId is expected to be present.
|
|
114
|
+
*/ const resolveLogoutDeviceId = async (userId, sessionId, clientDeviceId)=>{
|
|
115
|
+
if (!sessionId) {
|
|
116
|
+
strapi.log.debug('resolveLogoutDeviceId: no sessionId; falling back to client deviceId');
|
|
117
|
+
return clientDeviceId;
|
|
118
|
+
}
|
|
119
|
+
const session = await strapi.db.query(SESSION_CONTENT_TYPE).findOne({
|
|
120
|
+
where: {
|
|
121
|
+
sessionId
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
if (session?.userId !== userId || session?.origin !== ADMIN_ORIGIN) {
|
|
125
|
+
strapi.log.debug('resolveLogoutDeviceId: access-token session missing or not owned; falling back to client deviceId');
|
|
126
|
+
return clientDeviceId;
|
|
127
|
+
}
|
|
128
|
+
return typeof session.deviceId === 'string' ? session.deviceId : clientDeviceId;
|
|
129
|
+
};
|
|
83
130
|
|
|
84
131
|
exports.DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN;
|
|
85
132
|
exports.DEFAULT_IDLE_SESSION_LIFESPAN = DEFAULT_IDLE_SESSION_LIFESPAN;
|
|
@@ -87,9 +134,13 @@ exports.DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN;
|
|
|
87
134
|
exports.DEFAULT_MAX_SESSION_LIFESPAN = DEFAULT_MAX_SESSION_LIFESPAN;
|
|
88
135
|
exports.REFRESH_COOKIE_NAME = REFRESH_COOKIE_NAME;
|
|
89
136
|
exports.buildCookieOptionsWithExpiry = buildCookieOptionsWithExpiry;
|
|
137
|
+
exports.buildSessionMetadataFromContext = buildSessionMetadataFromContext;
|
|
90
138
|
exports.extractDeviceParams = extractDeviceParams;
|
|
91
139
|
exports.generateDeviceId = generateDeviceId;
|
|
140
|
+
exports.getAccessCookieDomain = getAccessCookieDomain;
|
|
92
141
|
exports.getAccessCookieName = getAccessCookieName;
|
|
142
|
+
exports.getAccessCookiePath = getAccessCookiePath;
|
|
93
143
|
exports.getRefreshCookieOptions = getRefreshCookieOptions;
|
|
94
144
|
exports.getSessionManager = getSessionManager;
|
|
145
|
+
exports.resolveLogoutDeviceId = resolveLogoutDeviceId;
|
|
95
146
|
//# sourceMappingURL=session-auth.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-auth.js","sources":["../../../../shared/utils/session-auth.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Modules } from '@strapi/types';\n\nimport { resolveAuthCookieName } from './auth-cookie-name';\n\nexport const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';\n\nexport const getAccessCookieName = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.name');\n return resolveAuthCookieName(configured);\n};\n\nexport const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;\nexport const DEFAULT_MAX_SESSION_LIFESPAN = 1 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;\n\nexport const getRefreshCookieOptions = (secureRequest?: boolean) => {\n const configuredSecure = strapi.config.get('admin.auth.cookie.secure');\n const isProduction = process.env.NODE_ENV === 'production';\n\n const domain: string | undefined =\n strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');\n const path: string = strapi.config.get('admin.auth.cookie.path', '/admin');\n\n const sameSite: boolean | 'lax' | 'strict' | 'none' =\n strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';\n\n let isSecure: boolean;\n if (typeof configuredSecure === 'boolean') {\n isSecure = configuredSecure;\n } else if (secureRequest !== undefined) {\n isSecure = isProduction && secureRequest;\n } else {\n isSecure = isProduction;\n }\n\n return {\n httpOnly: true,\n secure: isSecure,\n overwrite: true,\n domain,\n path,\n sameSite,\n maxAge: undefined,\n };\n};\n\nconst getLifespansForType = (\n type: 'refresh' | 'session'\n): { idleSeconds: number; maxSeconds: number } => {\n if (type === 'refresh') {\n const idleSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.idleRefreshTokenLifespan',\n DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN\n )\n );\n const maxSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.maxRefreshTokenLifespan',\n DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN\n )\n );\n\n return { idleSeconds, maxSeconds };\n }\n\n const idleSeconds = Number(\n strapi.config.get('admin.auth.sessions.idleSessionLifespan', DEFAULT_IDLE_SESSION_LIFESPAN)\n );\n const maxSeconds = Number(\n strapi.config.get('admin.auth.sessions.maxSessionLifespan', DEFAULT_MAX_SESSION_LIFESPAN)\n );\n\n return { idleSeconds, maxSeconds };\n};\n\nexport const buildCookieOptionsWithExpiry = (\n type: 'refresh' | 'session',\n absoluteExpiresAtISO?: string,\n secureRequest?: boolean\n) => {\n const base = getRefreshCookieOptions(secureRequest);\n if (type === 'session') {\n return base;\n }\n\n const { idleSeconds } = getLifespansForType('refresh');\n const now = Date.now();\n const idleExpiry = now + idleSeconds * 1000;\n const absoluteExpiry = absoluteExpiresAtISO\n ? new Date(absoluteExpiresAtISO).getTime()\n : idleExpiry;\n const chosen = new Date(Math.min(idleExpiry, absoluteExpiry));\n\n return { ...base, expires: chosen, maxAge: Math.max(0, chosen.getTime() - now) };\n};\n\nexport const getSessionManager = (): Modules.SessionManager.SessionManagerService | null => {\n const manager = strapi.sessionManager as Modules.SessionManager.SessionManagerService | undefined;\n return manager ?? null;\n};\n\nexport const generateDeviceId = (): string => crypto.randomUUID();\n\nexport const extractDeviceParams = (\n requestBody: unknown\n): { deviceId: string; rememberMe: boolean } => {\n const body = (requestBody ?? {}) as { deviceId?: string; rememberMe?: boolean };\n const deviceId = body.deviceId || generateDeviceId();\n const rememberMe = Boolean(body.rememberMe);\n\n return { deviceId, rememberMe };\n};\n"],"names":["REFRESH_COOKIE_NAME","getAccessCookieName","configured","strapi","config","get","resolveAuthCookieName","DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN","DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN","DEFAULT_MAX_SESSION_LIFESPAN","DEFAULT_IDLE_SESSION_LIFESPAN","getRefreshCookieOptions","secureRequest","configuredSecure","isProduction","process","env","NODE_ENV","domain","path","sameSite","isSecure","undefined","httpOnly","secure","overwrite","maxAge","getLifespansForType","type","idleSeconds","Number","maxSeconds","buildCookieOptionsWithExpiry","absoluteExpiresAtISO","base","now","Date","idleExpiry","absoluteExpiry","getTime","chosen","Math","min","expires","max","getSessionManager","manager","sessionManager","generateDeviceId","crypto","randomUUID","extractDeviceParams","requestBody","body","deviceId","rememberMe","Boolean"],"mappings":";;;;;;;;;AAKO,MAAMA,sBAAsB;MAEtBC,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMC,UAAAA,GAAiCC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOC,oCAAAA,CAAsBJ,UAAAA,CAAAA;AAC/B;AAEO,MAAMK,kCAAAA,GAAqC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC1D,MAAMC,mCAAAA,GAAsC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC3D,MAAMC,4BAAAA,GAA+B,CAAA,GAAI,EAAA,GAAK,KAAK;AACnD,MAAMC,6BAAAA,GAAgC,CAAA,GAAI,EAAA,GAAK;AAE/C,MAAMC,0BAA0B,CAACC,aAAAA,GAAAA;AACtC,IAAA,MAAMC,gBAAAA,GAAmBV,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,0BAAA,CAAA;AAC3C,IAAA,MAAMS,YAAAA,GAAeC,OAAAA,CAAQC,GAAG,CAACC,QAAQ,KAAK,YAAA;IAE9C,MAAMC,MAAAA,GACJf,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,0BAAA,CAAA,IAA+BF,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,mBAAA,CAAA;AACrE,IAAA,MAAMc,OAAehB,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,wBAAA,EAA0B,Q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GAAG,EAAA;IACpB,MAAME,UAAAA,GAAaF,MAAMN,WAAAA,GAAc,IAAA;AACvC,IAAA,MAAMS,iBAAiBL,oBAAAA,GACnB,IAAIG,IAAAA,CAAKH,oBAAAA,CAAAA,CAAsBM,OAAO,EAAA,GACtCF,UAAAA;AACJ,IAAA,MAAMG,SAAS,IAAIJ,IAAAA,CAAKK,IAAAA,CAAKC,GAAG,CAACL,UAAAA,EAAYC,cAAAA,CAAAA,CAAAA;IAE7C,OAAO;AAAE,QAAA,GAAGJ,IAAI;QAAES,OAAAA,EAASH,MAAAA;AAAQd,QAAAA,MAAAA,EAAQe,KAAKG,GAAG,CAAC,CAAA,EAAGJ,MAAAA,CAAOD,OAAO,EAAA,GAAKJ,GAAAA;AAAK,KAAA;AACjF;MAEaU,iBAAAA,GAAoB,IAAA;IAC/B,MAAMC,OAAAA,GAAU3C,OAAO4C,cAAc;AACrC,IAAA,OAAOD,OAAAA,IAAW,IAAA;AACpB;AAEO,MAAME,gBAAAA,GAAmB,IAAcC,uBAAAA,CAAOC,UAAU;AAExD,MAAMC,sBAAsB,CACjCC,WAAAA,GAAAA;IAEA,MAAMC,IAAAA,GAAQD,eAAe,EAAC;IAC9B,MAAME,QAAAA,GAAWD,IAAAA,CAAKC,QAAQ,IAAIN,gBAAAA,EAAAA;IAClC,MAAMO,UAAAA,GAAaC,OAAAA,CAAQH,IAAAA,CAAKE,UAAU,CAAA;IAE1C,OAAO;AAAED,QAAAA,QAAAA;AAAUC,QAAAA;AAAW,KAAA;AAChC;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"session-auth.js","sources":["../../../../shared/utils/session-auth.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Context } from 'koa';\nimport type { Modules } from '@strapi/types';\nimport { buildSessionMetadata } from '@strapi/utils';\n\nimport { resolveAuthCookieName } from './auth-cookie-name';\nimport { resolveAuthCookiePath } from './auth-cookie-path';\nimport { resolveAuthCookieDomain } from './auth-cookie-domain';\n\nconst ADMIN_ORIGIN = 'admin';\nconst SESSION_CONTENT_TYPE = 'admin::session';\n\nexport const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';\n\n// The resolvers are browser-shared (also inlined into the admin bundle) so\n// they default to console.warn; on the server, route their warnings through\n// the Strapi logger instead.\nconst warnViaStrapiLog = (message: string): void => {\n strapi.log.warn(message);\n};\n\nexport const getAccessCookieName = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.name');\n return resolveAuthCookieName(configured, warnViaStrapiLog);\n};\n\nexport const getAccessCookiePath = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.path');\n return resolveAuthCookiePath(configured, warnViaStrapiLog);\n};\n\nexport const getAccessCookieDomain = (): string | undefined => {\n const configured: string | undefined =\n strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');\n return resolveAuthCookieDomain(configured, warnViaStrapiLog);\n};\n\nexport const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;\nexport const DEFAULT_MAX_SESSION_LIFESPAN = 1 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;\n\nexport const getRefreshCookieOptions = (secureRequest?: boolean) => {\n const configuredSecure = strapi.config.get('admin.auth.cookie.secure');\n const isProduction = process.env.NODE_ENV === 'production';\n\n const domain = getAccessCookieDomain();\n const path = getAccessCookiePath();\n\n const sameSite: boolean | 'lax' | 'strict' | 'none' =\n strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';\n\n let isSecure: boolean;\n if (typeof configuredSecure === 'boolean') {\n isSecure = configuredSecure;\n } else if (secureRequest !== undefined) {\n isSecure = isProduction && secureRequest;\n } else {\n isSecure = isProduction;\n }\n\n return {\n httpOnly: true,\n secure: isSecure,\n overwrite: true,\n domain,\n path,\n sameSite,\n maxAge: undefined,\n };\n};\n\nconst getLifespansForType = (\n type: 'refresh' | 'session'\n): { idleSeconds: number; maxSeconds: number } => {\n if (type === 'refresh') {\n const idleSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.idleRefreshTokenLifespan',\n DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN\n )\n );\n const maxSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.maxRefreshTokenLifespan',\n DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN\n )\n );\n\n return { idleSeconds, maxSeconds };\n }\n\n const idleSeconds = Number(\n strapi.config.get('admin.auth.sessions.idleSessionLifespan', DEFAULT_IDLE_SESSION_LIFESPAN)\n );\n const maxSeconds = Number(\n strapi.config.get('admin.auth.sessions.maxSessionLifespan', DEFAULT_MAX_SESSION_LIFESPAN)\n );\n\n return { idleSeconds, maxSeconds };\n};\n\nexport const buildCookieOptionsWithExpiry = (\n type: 'refresh' | 'session',\n absoluteExpiresAtISO?: string,\n secureRequest?: boolean\n) => {\n const base = getRefreshCookieOptions(secureRequest);\n if (type === 'session') {\n return base;\n }\n\n const { idleSeconds } = getLifespansForType('refresh');\n const now = Date.now();\n const idleExpiry = now + idleSeconds * 1000;\n const absoluteExpiry = absoluteExpiresAtISO\n ? new Date(absoluteExpiresAtISO).getTime()\n : idleExpiry;\n const chosen = new Date(Math.min(idleExpiry, absoluteExpiry));\n\n return { ...base, expires: chosen, maxAge: Math.max(0, chosen.getTime() - now) };\n};\n\nexport const getSessionManager = (): Modules.SessionManager.SessionManagerService | null => {\n const manager = strapi.sessionManager as Modules.SessionManager.SessionManagerService | undefined;\n return manager ?? null;\n};\n\nexport const generateDeviceId = (): string => crypto.randomUUID();\n\nexport const extractDeviceParams = (\n requestBody: unknown\n): { deviceId: string; rememberMe: boolean } => {\n const body = (requestBody ?? {}) as { deviceId?: string; rememberMe?: boolean };\n const deviceId = body.deviceId || generateDeviceId();\n const rememberMe = Boolean(body.rememberMe);\n\n return { deviceId, rememberMe };\n};\n\nexport const buildSessionMetadataFromContext = (ctx: Context) =>\n buildSessionMetadata({\n userAgent: ctx.request.headers['user-agent'],\n });\n\n/**\n * Resolves the device id to use when revoking sessions on logout.\n * SSO assigns deviceId server-side, so the client-provided value may not match\n * the active session row. Prefer the deviceId stored on the session backing\n * the current access token when available.\n *\n * Callers should pass `ctx.state.session.id` from the admin auth strategy and\n * the already-parsed body `deviceId` — the logout route requires authentication,\n * so sessionId is expected to be present.\n */\nexport const resolveLogoutDeviceId = async (\n userId: string,\n sessionId: string | undefined,\n clientDeviceId: string | undefined\n): Promise<string | undefined> => {\n if (!sessionId) {\n strapi.log.debug('resolveLogoutDeviceId: no sessionId; falling back to client deviceId');\n return clientDeviceId;\n }\n\n const session = await strapi.db.query(SESSION_CONTENT_TYPE).findOne({\n where: { sessionId },\n });\n\n if (session?.userId !== userId || session?.origin !== ADMIN_ORIGIN) {\n strapi.log.debug(\n 'resolveLogoutDeviceId: access-token session missing or not owned; falling back to client deviceId'\n );\n return clientDeviceId;\n }\n\n return typeof session.deviceId === 'string' ? session.deviceId : clientDeviceId;\n};\n"],"names":["ADMIN_ORIGIN","SESSION_CONTENT_TYPE","REFRESH_COOKIE_NAME","warnViaStrapiLog","message","strapi","log","warn","getAccessCookieName","configured","config","get","resolveAuthCookieName","getAccessCookiePath","resolveAuthCookiePath","getAccessCookieDomain","resolveAuthCookieDomain","DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN","DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN","DEFAULT_MAX_SESSION_LIFESPAN","DEFAULT_IDLE_SESSION_LIFESPAN","getRefreshCookieOptions","secureRequest","configuredSecure","isProduction","process","env","NODE_ENV","domain","path","sameSite","isSecure","undefined","httpOnly","secure","overwrite","maxAge","getLifespansForType","type","idleSeconds","Number","maxSeconds","buildCookieOptionsWithExpiry","absoluteExpiresAtISO","base","now","Date","idleExpiry","absoluteExpiry","getTime","chosen","Math","min","expires","max","getSessionManager","manager","sessionManager","generateDeviceId","crypto","randomUUID","extractDeviceParams","requestBody","body","deviceId","rememberMe","Boolean","buildSessionMetadataFromContext","ctx","buildSessionMetadata","userAgent","request","headers","resolveLogoutDeviceId","userId","sessionId","clientDeviceId","debug","session","db","query","findOne","where","origin"],"mappings":";;;;;;;;;;;;AASA,MAAMA,YAAAA,GAAe,OAAA;AACrB,MAAMC,oBAAAA,GAAuB,gBAAA;AAEtB,MAAMC,sBAAsB;AAEnC;AACA;AACA;AACA,MAAMC,mBAAmB,CAACC,OAAAA,GAAAA;IACxBC,MAAAA,CAAOC,GAAG,CAACC,IAAI,CAACH,OAAAA,CAAAA;AAClB,CAAA;MAEaI,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMC,UAAAA,GAAiCJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOC,qCAAsBH,UAAAA,EAAYN,gBAAAA,CAAAA;AAC3C;MAEaU,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMJ,UAAAA,GAAiCJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOG,qCAAsBL,UAAAA,EAAYN,gBAAAA,CAAAA;AAC3C;MAEaY,qBAAAA,GAAwB,IAAA;IACnC,MAAMN,UAAAA,GACJJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,0BAAA,CAAA,IAA+BN,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,mBAAA,CAAA;AACrE,IAAA,OAAOK,yCAAwBP,UAAAA,EAAYN,gBAAAA,CAAAA;AAC7C;AAEO,MAAMc,kCAAAA,GAAqC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC1D,MAAMC,mCAAAA,GAAsC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC3D,MAAMC,4BAAAA,GAA+B,CAAA,GAAI,EAAA,GAAK,KAAK;AACnD,MAAMC,6BAAAA,GAAgC,CAAA,GAAI,EAAA,GAAK;AAE/C,MAAMC,0BAA0B,CAACC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AAAA,GAAkC,CAACC,GAAAA,GAC9CC,0BAAAA,CAAqB;AACnBC,QAAAA,SAAAA,EAAWF,GAAAA,CAAIG,OAAO,CAACC,OAAO,CAAC,YAAA;KACjC;AAEF;;;;;;;;;AASC,IACM,MAAMC,qBAAAA,GAAwB,OACnCC,QACAC,SAAAA,EACAC,cAAAA,GAAAA;AAEA,IAAA,IAAI,CAACD,SAAAA,EAAW;QACdtE,MAAAA,CAAOC,GAAG,CAACuE,KAAK,CAAC,sEAAA,CAAA;QACjB,OAAOD,cAAAA;AACT,IAAA;IAEA,MAAME,OAAAA,GAAU,MAAMzE,MAAAA,CAAO0E,EAAE,CAACC,KAAK,CAAC/E,oBAAAA,CAAAA,CAAsBgF,OAAO,CAAC;QAClEC,KAAAA,EAAO;AAAEP,YAAAA;AAAU;AACrB,KAAA,CAAA;AAEA,IAAA,IAAIG,OAAAA,EAASJ,MAAAA,KAAWA,MAAAA,IAAUI,OAAAA,EAASK,WAAWnF,YAAAA,EAAc;QAClEK,MAAAA,CAAOC,GAAG,CAACuE,KAAK,CACd,mGAAA,CAAA;QAEF,OAAOD,cAAAA;AACT,IAAA;AAEA,IAAA,OAAO,OAAOE,OAAAA,CAAQd,QAAQ,KAAK,QAAA,GAAWc,OAAAA,CAAQd,QAAQ,GAAGY,cAAAA;AACnE;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,10 +1,29 @@
|
|
|
1
1
|
import crypto from 'crypto';
|
|
2
|
+
import { buildSessionMetadata } from '@strapi/utils';
|
|
2
3
|
import { resolveAuthCookieName } from './auth-cookie-name.mjs';
|
|
4
|
+
import { resolveAuthCookiePath } from './auth-cookie-path.mjs';
|
|
5
|
+
import { resolveAuthCookieDomain } from './auth-cookie-domain.mjs';
|
|
3
6
|
|
|
7
|
+
const ADMIN_ORIGIN = 'admin';
|
|
8
|
+
const SESSION_CONTENT_TYPE = 'admin::session';
|
|
4
9
|
const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';
|
|
10
|
+
// The resolvers are browser-shared (also inlined into the admin bundle) so
|
|
11
|
+
// they default to console.warn; on the server, route their warnings through
|
|
12
|
+
// the Strapi logger instead.
|
|
13
|
+
const warnViaStrapiLog = (message)=>{
|
|
14
|
+
strapi.log.warn(message);
|
|
15
|
+
};
|
|
5
16
|
const getAccessCookieName = ()=>{
|
|
6
17
|
const configured = strapi.config.get('admin.auth.cookie.name');
|
|
7
|
-
return resolveAuthCookieName(configured);
|
|
18
|
+
return resolveAuthCookieName(configured, warnViaStrapiLog);
|
|
19
|
+
};
|
|
20
|
+
const getAccessCookiePath = ()=>{
|
|
21
|
+
const configured = strapi.config.get('admin.auth.cookie.path');
|
|
22
|
+
return resolveAuthCookiePath(configured, warnViaStrapiLog);
|
|
23
|
+
};
|
|
24
|
+
const getAccessCookieDomain = ()=>{
|
|
25
|
+
const configured = strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');
|
|
26
|
+
return resolveAuthCookieDomain(configured, warnViaStrapiLog);
|
|
8
27
|
};
|
|
9
28
|
const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;
|
|
10
29
|
const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;
|
|
@@ -13,8 +32,8 @@ const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;
|
|
|
13
32
|
const getRefreshCookieOptions = (secureRequest)=>{
|
|
14
33
|
const configuredSecure = strapi.config.get('admin.auth.cookie.secure');
|
|
15
34
|
const isProduction = process.env.NODE_ENV === 'production';
|
|
16
|
-
const domain =
|
|
17
|
-
const path =
|
|
35
|
+
const domain = getAccessCookieDomain();
|
|
36
|
+
const path = getAccessCookiePath();
|
|
18
37
|
const sameSite = strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';
|
|
19
38
|
let isSecure;
|
|
20
39
|
if (typeof configuredSecure === 'boolean') {
|
|
@@ -74,6 +93,34 @@ const extractDeviceParams = (requestBody)=>{
|
|
|
74
93
|
rememberMe
|
|
75
94
|
};
|
|
76
95
|
};
|
|
96
|
+
const buildSessionMetadataFromContext = (ctx)=>buildSessionMetadata({
|
|
97
|
+
userAgent: ctx.request.headers['user-agent']
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Resolves the device id to use when revoking sessions on logout.
|
|
101
|
+
* SSO assigns deviceId server-side, so the client-provided value may not match
|
|
102
|
+
* the active session row. Prefer the deviceId stored on the session backing
|
|
103
|
+
* the current access token when available.
|
|
104
|
+
*
|
|
105
|
+
* Callers should pass `ctx.state.session.id` from the admin auth strategy and
|
|
106
|
+
* the already-parsed body `deviceId` — the logout route requires authentication,
|
|
107
|
+
* so sessionId is expected to be present.
|
|
108
|
+
*/ const resolveLogoutDeviceId = async (userId, sessionId, clientDeviceId)=>{
|
|
109
|
+
if (!sessionId) {
|
|
110
|
+
strapi.log.debug('resolveLogoutDeviceId: no sessionId; falling back to client deviceId');
|
|
111
|
+
return clientDeviceId;
|
|
112
|
+
}
|
|
113
|
+
const session = await strapi.db.query(SESSION_CONTENT_TYPE).findOne({
|
|
114
|
+
where: {
|
|
115
|
+
sessionId
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
if (session?.userId !== userId || session?.origin !== ADMIN_ORIGIN) {
|
|
119
|
+
strapi.log.debug('resolveLogoutDeviceId: access-token session missing or not owned; falling back to client deviceId');
|
|
120
|
+
return clientDeviceId;
|
|
121
|
+
}
|
|
122
|
+
return typeof session.deviceId === 'string' ? session.deviceId : clientDeviceId;
|
|
123
|
+
};
|
|
77
124
|
|
|
78
|
-
export { DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN, DEFAULT_IDLE_SESSION_LIFESPAN, DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN, DEFAULT_MAX_SESSION_LIFESPAN, REFRESH_COOKIE_NAME, buildCookieOptionsWithExpiry, extractDeviceParams, generateDeviceId, getAccessCookieName, getRefreshCookieOptions, getSessionManager };
|
|
125
|
+
export { DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN, DEFAULT_IDLE_SESSION_LIFESPAN, DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN, DEFAULT_MAX_SESSION_LIFESPAN, REFRESH_COOKIE_NAME, buildCookieOptionsWithExpiry, buildSessionMetadataFromContext, extractDeviceParams, generateDeviceId, getAccessCookieDomain, getAccessCookieName, getAccessCookiePath, getRefreshCookieOptions, getSessionManager, resolveLogoutDeviceId };
|
|
79
126
|
//# sourceMappingURL=session-auth.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-auth.mjs","sources":["../../../../shared/utils/session-auth.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Modules } from '@strapi/types';\n\nimport { resolveAuthCookieName } from './auth-cookie-name';\n\nexport const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';\n\nexport const getAccessCookieName = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.name');\n return resolveAuthCookieName(configured);\n};\n\nexport const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;\nexport const DEFAULT_MAX_SESSION_LIFESPAN = 1 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;\n\nexport const getRefreshCookieOptions = (secureRequest?: boolean) => {\n const configuredSecure = strapi.config.get('admin.auth.cookie.secure');\n const isProduction = process.env.NODE_ENV === 'production';\n\n const domain: string | undefined =\n strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');\n const path: string = strapi.config.get('admin.auth.cookie.path', '/admin');\n\n const sameSite: boolean | 'lax' | 'strict' | 'none' =\n strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';\n\n let isSecure: boolean;\n if (typeof configuredSecure === 'boolean') {\n isSecure = configuredSecure;\n } else if (secureRequest !== undefined) {\n isSecure = isProduction && secureRequest;\n } else {\n isSecure = isProduction;\n }\n\n return {\n httpOnly: true,\n secure: isSecure,\n overwrite: true,\n domain,\n path,\n sameSite,\n maxAge: undefined,\n };\n};\n\nconst getLifespansForType = (\n type: 'refresh' | 'session'\n): { idleSeconds: number; maxSeconds: number } => {\n if (type === 'refresh') {\n const idleSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.idleRefreshTokenLifespan',\n DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN\n )\n );\n const maxSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.maxRefreshTokenLifespan',\n DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN\n )\n );\n\n return { idleSeconds, maxSeconds };\n }\n\n const idleSeconds = Number(\n strapi.config.get('admin.auth.sessions.idleSessionLifespan', DEFAULT_IDLE_SESSION_LIFESPAN)\n );\n const maxSeconds = Number(\n strapi.config.get('admin.auth.sessions.maxSessionLifespan', DEFAULT_MAX_SESSION_LIFESPAN)\n );\n\n return { idleSeconds, maxSeconds };\n};\n\nexport const buildCookieOptionsWithExpiry = (\n type: 'refresh' | 'session',\n absoluteExpiresAtISO?: string,\n secureRequest?: boolean\n) => {\n const base = getRefreshCookieOptions(secureRequest);\n if (type === 'session') {\n return base;\n }\n\n const { idleSeconds } = getLifespansForType('refresh');\n const now = Date.now();\n const idleExpiry = now + idleSeconds * 1000;\n const absoluteExpiry = absoluteExpiresAtISO\n ? new Date(absoluteExpiresAtISO).getTime()\n : idleExpiry;\n const chosen = new Date(Math.min(idleExpiry, absoluteExpiry));\n\n return { ...base, expires: chosen, maxAge: Math.max(0, chosen.getTime() - now) };\n};\n\nexport const getSessionManager = (): Modules.SessionManager.SessionManagerService | null => {\n const manager = strapi.sessionManager as Modules.SessionManager.SessionManagerService | undefined;\n return manager ?? null;\n};\n\nexport const generateDeviceId = (): string => crypto.randomUUID();\n\nexport const extractDeviceParams = (\n requestBody: unknown\n): { deviceId: string; rememberMe: boolean } => {\n const body = (requestBody ?? {}) as { deviceId?: string; rememberMe?: boolean };\n const deviceId = body.deviceId || generateDeviceId();\n const rememberMe = Boolean(body.rememberMe);\n\n return { deviceId, rememberMe };\n};\n"],"names":["REFRESH_COOKIE_NAME","getAccessCookieName","configured","strapi","config","get","resolveAuthCookieName","DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN","DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN","DEFAULT_MAX_SESSION_LIFESPAN","DEFAULT_IDLE_SESSION_LIFESPAN","getRefreshCookieOptions","secureRequest","configuredSecure","isProduction","process","env","NODE_ENV","domain","path","sameSite","isSecure","undefined","httpOnly","secure","overwrite","maxAge","getLifespansForType","type","idleSeconds","Number","maxSeconds","buildCookieOptionsWithExpiry","absoluteExpiresAtISO","base","now","Date","idleExpiry","absoluteExpiry","getTime","chosen","Math","min","expires","max","getSessionManager","manager","sessionManager","generateDeviceId","crypto","randomUUID","extractDeviceParams","requestBody","body","deviceId","rememberMe","Boolean"],"mappings":";;;AAKO,MAAMA,sBAAsB;MAEtBC,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMC,UAAAA,GAAiCC,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOC,qBAAAA,CAAsBJ,UAAAA,CAAAA;AAC/B;AAEO,MAAMK,kCAAAA,GAAqC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC1D,MAAMC,mCAAAA,GAAsC,EAAA,GAAK,EAAA,GAAK,KAAK;AAC3D,MAAMC,4BAAAA,GAA+B,CAAA,GAAI,EAAA,GAAK,KAAK;AACnD,MAAMC,6BAAAA,GAAgC,CAAA,GAAI,EAAA,GAAK;AAE/C,MAAMC,0BAA0B,CAACC,aAAAA,GAAAA;AACtC,IAAA,MAAMC,gBAAAA,GAAmBV,MAAAA,CAAOC,MAAM,CAACC,GAAG,CAAC,0BAAA,CAAA;AAC3C,IAAA,MAAMS,YAAAA,GAAeC,OAAAA,CAAQC,GAAG,CAACC,QAAQ,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ils/session-auth.ts"],"sourcesContent":["import crypto from 'crypto';\nimport type { Context } from 'koa';\nimport type { Modules } from '@strapi/types';\nimport { buildSessionMetadata } from '@strapi/utils';\n\nimport { resolveAuthCookieName } from './auth-cookie-name';\nimport { resolveAuthCookiePath } from './auth-cookie-path';\nimport { resolveAuthCookieDomain } from './auth-cookie-domain';\n\nconst ADMIN_ORIGIN = 'admin';\nconst SESSION_CONTENT_TYPE = 'admin::session';\n\nexport const REFRESH_COOKIE_NAME = 'strapi_admin_refresh';\n\n// The resolvers are browser-shared (also inlined into the admin bundle) so\n// they default to console.warn; on the server, route their warnings through\n// the Strapi logger instead.\nconst warnViaStrapiLog = (message: string): void => {\n strapi.log.warn(message);\n};\n\nexport const getAccessCookieName = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.name');\n return resolveAuthCookieName(configured, warnViaStrapiLog);\n};\n\nexport const getAccessCookiePath = (): string => {\n const configured: string | undefined = strapi.config.get('admin.auth.cookie.path');\n return resolveAuthCookiePath(configured, warnViaStrapiLog);\n};\n\nexport const getAccessCookieDomain = (): string | undefined => {\n const configured: string | undefined =\n strapi.config.get('admin.auth.cookie.domain') || strapi.config.get('admin.auth.domain');\n return resolveAuthCookieDomain(configured, warnViaStrapiLog);\n};\n\nexport const DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN = 30 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN = 14 * 24 * 60 * 60;\nexport const DEFAULT_MAX_SESSION_LIFESPAN = 1 * 24 * 60 * 60;\nexport const DEFAULT_IDLE_SESSION_LIFESPAN = 2 * 60 * 60;\n\nexport const getRefreshCookieOptions = (secureRequest?: boolean) => {\n const configuredSecure = strapi.config.get('admin.auth.cookie.secure');\n const isProduction = process.env.NODE_ENV === 'production';\n\n const domain = getAccessCookieDomain();\n const path = getAccessCookiePath();\n\n const sameSite: boolean | 'lax' | 'strict' | 'none' =\n strapi.config.get('admin.auth.cookie.sameSite') ?? 'lax';\n\n let isSecure: boolean;\n if (typeof configuredSecure === 'boolean') {\n isSecure = configuredSecure;\n } else if (secureRequest !== undefined) {\n isSecure = isProduction && secureRequest;\n } else {\n isSecure = isProduction;\n }\n\n return {\n httpOnly: true,\n secure: isSecure,\n overwrite: true,\n domain,\n path,\n sameSite,\n maxAge: undefined,\n };\n};\n\nconst getLifespansForType = (\n type: 'refresh' | 'session'\n): { idleSeconds: number; maxSeconds: number } => {\n if (type === 'refresh') {\n const idleSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.idleRefreshTokenLifespan',\n DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN\n )\n );\n const maxSeconds = Number(\n strapi.config.get(\n 'admin.auth.sessions.maxRefreshTokenLifespan',\n DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN\n )\n );\n\n return { idleSeconds, maxSeconds };\n }\n\n const idleSeconds = Number(\n strapi.config.get('admin.auth.sessions.idleSessionLifespan', DEFAULT_IDLE_SESSION_LIFESPAN)\n );\n const maxSeconds = Number(\n strapi.config.get('admin.auth.sessions.maxSessionLifespan', DEFAULT_MAX_SESSION_LIFESPAN)\n );\n\n return { idleSeconds, maxSeconds };\n};\n\nexport const buildCookieOptionsWithExpiry = (\n type: 'refresh' | 'session',\n absoluteExpiresAtISO?: string,\n secureRequest?: boolean\n) => {\n const base = getRefreshCookieOptions(secureRequest);\n if (type === 'session') {\n return base;\n }\n\n const { idleSeconds } = getLifespansForType('refresh');\n const now = Date.now();\n const idleExpiry = now + idleSeconds * 1000;\n const absoluteExpiry = absoluteExpiresAtISO\n ? new Date(absoluteExpiresAtISO).getTime()\n : idleExpiry;\n const chosen = new Date(Math.min(idleExpiry, absoluteExpiry));\n\n return { ...base, expires: chosen, maxAge: Math.max(0, chosen.getTime() - now) };\n};\n\nexport const getSessionManager = (): Modules.SessionManager.SessionManagerService | null => {\n const manager = strapi.sessionManager as Modules.SessionManager.SessionManagerService | undefined;\n return manager ?? null;\n};\n\nexport const generateDeviceId = (): string => crypto.randomUUID();\n\nexport const extractDeviceParams = (\n requestBody: unknown\n): { deviceId: string; rememberMe: boolean } => {\n const body = (requestBody ?? {}) as { deviceId?: string; rememberMe?: boolean };\n const deviceId = body.deviceId || generateDeviceId();\n const rememberMe = Boolean(body.rememberMe);\n\n return { deviceId, rememberMe };\n};\n\nexport const buildSessionMetadataFromContext = (ctx: Context) =>\n buildSessionMetadata({\n userAgent: ctx.request.headers['user-agent'],\n });\n\n/**\n * Resolves the device id to use when revoking sessions on logout.\n * SSO assigns deviceId server-side, so the client-provided value may not match\n * the active session row. Prefer the deviceId stored on the session backing\n * the current access token when available.\n *\n * Callers should pass `ctx.state.session.id` from the admin auth strategy and\n * the already-parsed body `deviceId` — the logout route requires authentication,\n * so sessionId is expected to be present.\n */\nexport const resolveLogoutDeviceId = async (\n userId: string,\n sessionId: string | undefined,\n clientDeviceId: string | undefined\n): Promise<string | undefined> => {\n if (!sessionId) {\n strapi.log.debug('resolveLogoutDeviceId: no sessionId; falling back to client deviceId');\n return clientDeviceId;\n }\n\n const session = await strapi.db.query(SESSION_CONTENT_TYPE).findOne({\n where: { sessionId },\n });\n\n if (session?.userId !== userId || session?.origin !== ADMIN_ORIGIN) {\n strapi.log.debug(\n 'resolveLogoutDeviceId: access-token session missing or not owned; falling back to client deviceId'\n );\n return clientDeviceId;\n }\n\n return typeof session.deviceId === 'string' ? session.deviceId : clientDeviceId;\n};\n"],"names":["ADMIN_ORIGIN","SESSION_CONTENT_TYPE","REFRESH_COOKIE_NAME","warnViaStrapiLog","message","strapi","log","warn","getAccessCookieName","configured","config","get","resolveAuthCookieName","getAccessCookiePath","resolveAuthCookiePath","getAccessCookieDomain","resolveAuthCookieDomain","DEFAULT_MAX_REFRESH_TOKEN_LIFESPAN","DEFAULT_IDLE_REFRESH_TOKEN_LIFESPAN","DEFAULT_MAX_SESSION_LIFESPAN","DEFAULT_IDLE_SESSION_LIFESPAN","getRefreshCookieOptions","secureRequest","configuredSecure","isProduction","process","env","NODE_ENV","domain","path","sameSite","isSecure","undefined","httpOnly","secure","overwrite","maxAge","getLifespansForType","type","idleSeconds","Number","maxSeconds","buildCookieOptionsWithExpiry","absoluteExpiresAtISO","base","now","Date","idleExpiry","absoluteExpiry","getTime","chosen","Math","min","expires","max","getSessionManager","manager","sessionManager","generateDeviceId","crypto","randomUUID","extractDeviceParams","requestBody","body","deviceId","rememberMe","Boolean","buildSessionMetadataFromContext","ctx","buildSessionMetadata","userAgent","request","headers","resolveLogoutDeviceId","userId","sessionId","clientDeviceId","debug","session","db","query","findOne","where","origin"],"mappings":";;;;;;AASA,MAAMA,YAAAA,GAAe,OAAA;AACrB,MAAMC,oBAAAA,GAAuB,gBAAA;AAEtB,MAAMC,sBAAsB;AAEnC;AACA;AACA;AACA,MAAMC,mBAAmB,CAACC,OAAAA,GAAAA;IACxBC,MAAAA,CAAOC,GAAG,CAACC,IAAI,CAACH,OAAAA,CAAAA;AAClB,CAAA;MAEaI,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMC,UAAAA,GAAiCJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOC,sBAAsBH,UAAAA,EAAYN,gBAAAA,CAAAA;AAC3C;MAEaU,mBAAAA,GAAsB,IAAA;AACjC,IAAA,MAAMJ,UAAAA,GAAiCJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,wBAAA,CAAA;AACzD,IAAA,OAAOG,sBAAsBL,UAAAA,EAAYN,gBAAAA,CAAAA;AAC3C;MAEaY,qBAAAA,GAAwB,IAAA;IACnC,MAAMN,UAAAA,GACJJ,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,0BAAA,CAAA,IAA+BN,MAAAA,CAAOK,MAAM,CAACC,GAAG,CAAC,mBAAA,CAAA;AACrE,IAAA,OAAOK,wBAAwBP,UAAAA,EAAYN,gBAAAA,CAAAA;AAC7C;AAEO,MAAMc,kCAAAA,GAAqC,EAAA,GAAK,EAAA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AAME,QAAAA,GAAWD,IAAAA,CAAKC,QAAQ,IAAIN,gBAAAA,EAAAA;IAClC,MAAMO,UAAAA,GAAaC,OAAAA,CAAQH,IAAAA,CAAKE,UAAU,CAAA;IAE1C,OAAO;AAAED,QAAAA,QAAAA;AAAUC,QAAAA;AAAW,KAAA;AAChC;AAEO,MAAME,+BAAAA,GAAkC,CAACC,GAAAA,GAC9CC,oBAAAA,CAAqB;AACnBC,QAAAA,SAAAA,EAAWF,GAAAA,CAAIG,OAAO,CAACC,OAAO,CAAC,YAAA;KACjC;AAEF;;;;;;;;;AASC,IACM,MAAMC,qBAAAA,GAAwB,OACnCC,QACAC,SAAAA,EACAC,cAAAA,GAAAA;AAEA,IAAA,IAAI,CAACD,SAAAA,EAAW;QACdtE,MAAAA,CAAOC,GAAG,CAACuE,KAAK,CAAC,sEAAA,CAAA;QACjB,OAAOD,cAAAA;AACT,IAAA;IAEA,MAAME,OAAAA,GAAU,MAAMzE,MAAAA,CAAO0E,EAAE,CAACC,KAAK,CAAC/E,oBAAAA,CAAAA,CAAsBgF,OAAO,CAAC;QAClEC,KAAAA,EAAO;AAAEP,YAAAA;AAAU;AACrB,KAAA,CAAA;AAEA,IAAA,IAAIG,OAAAA,EAASJ,MAAAA,KAAWA,MAAAA,IAAUI,OAAAA,EAASK,WAAWnF,YAAAA,EAAc;QAClEK,MAAAA,CAAOC,GAAG,CAACuE,KAAK,CACd,mGAAA,CAAA;QAEF,OAAOD,cAAAA;AACT,IAAA;AAEA,IAAA,OAAO,OAAOE,OAAAA,CAAQd,QAAQ,KAAK,QAAA,GAAWc,OAAAA,CAAQd,QAAQ,GAAGY,cAAAA;AACnE;;;;"}
|
|
@@ -58,6 +58,12 @@ declare const _default: {
|
|
|
58
58
|
private: boolean;
|
|
59
59
|
searchable: boolean;
|
|
60
60
|
};
|
|
61
|
+
resetPasswordTokenExpiresAt: {
|
|
62
|
+
type: string;
|
|
63
|
+
configurable: boolean;
|
|
64
|
+
private: boolean;
|
|
65
|
+
searchable: boolean;
|
|
66
|
+
};
|
|
61
67
|
registrationToken: {
|
|
62
68
|
type: string;
|
|
63
69
|
configurable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../../server/src/content-types/User.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"User.d.ts","sourceRoot":"","sources":["../../../../server/src/content-types/User.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wBAuHE"}
|
|
@@ -129,6 +129,12 @@ declare const _default: {
|
|
|
129
129
|
private: boolean;
|
|
130
130
|
searchable: boolean;
|
|
131
131
|
};
|
|
132
|
+
resetPasswordTokenExpiresAt: {
|
|
133
|
+
type: string;
|
|
134
|
+
configurable: boolean;
|
|
135
|
+
private: boolean;
|
|
136
|
+
searchable: boolean;
|
|
137
|
+
};
|
|
132
138
|
registrationToken: {
|
|
133
139
|
type: string;
|
|
134
140
|
configurable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/content-types/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../server/src/content-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,wBASE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,KAAK,CAAC;AAGzC,OAAO,eAAe,CAAC;;;
|
|
1
|
+
{"version":3,"file":"authentication.d.ts","sourceRoot":"","sources":["../../../../server/src/controllers/authentication.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAQ,MAAM,KAAK,CAAC;AAGzC,OAAO,eAAe,CAAC;;;0BAqHO,OAAO;kBAcf,OAAO;uBAiDF,OAAO;wBAmDN,OAAO;uBAUR,OAAO;qBAsDT,OAAO;gBAyCZ,OAAO;;AA7S3B,wBA2UE"}
|
|
@@ -10,6 +10,7 @@ export declare function createUser(attributes: Partial<AdminUserCreationPayload>
|
|
|
10
10
|
email?: string | undefined;
|
|
11
11
|
password?: string | undefined;
|
|
12
12
|
resetPasswordToken?: string | null | undefined;
|
|
13
|
+
resetPasswordTokenExpiresAt?: (string | Date | null) | undefined;
|
|
13
14
|
registrationToken?: string | null | undefined;
|
|
14
15
|
preferedLanguage?: string | undefined;
|
|
15
16
|
roles: import("@strapi/types/dist/data/constants.js").ID[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../server/src/domain/user.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EAET,wBAAwB,EACzB,MAAM,kCAAkC,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,wBAAwB,CAAC
|
|
1
|
+
{"version":3,"file":"user.d.ts","sourceRoot":"","sources":["../../../../server/src/domain/user.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EAET,wBAAwB,EACzB,MAAM,kCAAkC,CAAC;AAI1C;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,OAAO,CAAC,wBAAwB,CAAC;;;;;;;;;;;;EAOvE;AAED,eAAO,MAAM,iBAAiB,GAAI,MAAM,SAAS,YAEhD,CAAC;AAEF,eAAO,MAAM,yBAAyB,UAOrC,CAAC;;;8BAXsC,SAAS;;;AAajD,wBAIE"}
|
|
@@ -500,6 +500,12 @@ declare let admin: {
|
|
|
500
500
|
private: boolean;
|
|
501
501
|
searchable: boolean;
|
|
502
502
|
};
|
|
503
|
+
resetPasswordTokenExpiresAt: {
|
|
504
|
+
type: string;
|
|
505
|
+
configurable: boolean;
|
|
506
|
+
private: boolean;
|
|
507
|
+
searchable: boolean;
|
|
508
|
+
};
|
|
503
509
|
registrationToken: {
|
|
504
510
|
type: string;
|
|
505
511
|
configurable: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AAeA,QAAA,IAAI,KAAK;;;;;;;;;;;;;;;;;;;;;;sBAPG,GAAG;;;;;sBAAH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../server/src/index.ts"],"names":[],"mappings":"AAeA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