@frontegg/nextjs 9.2.12 → 9.2.13-alpha.22662318814
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/CHANGELOG.md +6 -0
- package/api/index.d.ts +1 -1
- package/app/ClientFronteggProvider.js +1 -2
- package/app/ClientFronteggProvider.js.map +1 -1
- package/app/FronteggAppProvider.d.ts +2 -2
- package/app/FronteggAppRouter.d.ts +2 -1
- package/common/AppContext.d.ts +0 -1
- package/common/FronteggBaseProvider.js +6 -8
- package/common/FronteggBaseProvider.js.map +1 -1
- package/common/FronteggRouterBase.d.ts +2 -2
- package/common/FronteggRouterBase.js +1 -2
- package/common/FronteggRouterBase.js.map +1 -1
- package/common/cmc/base.js +1 -2
- package/common/cmc/base.js.map +1 -1
- package/common/cmc/hooks.js +1 -2
- package/common/cmc/hooks.js.map +1 -1
- package/config/constants.js +96 -0
- package/config/constants.js.map +1 -1
- package/config/index.js +0 -1
- package/config/index.js.map +1 -1
- package/edge/redirectToLogin.d.ts +1 -1
- package/edge/shouldBypassMiddleware.d.ts +1 -1
- package/index.js +1 -1
- package/iron-session-edge.d.ts +6 -0
- package/middleware/FronteggProxy.d.ts +1 -1
- package/middleware/ProxyRequestCallback.d.ts +0 -1
- package/middleware/helpers.d.ts +1 -1
- package/no-ssr/ExpireInListener.d.ts +2 -1
- package/no-ssr/ExpireInListener.js +1 -2
- package/no-ssr/ExpireInListener.js.map +1 -1
- package/no-ssr/FronteggProviderNoSSR.js +3 -5
- package/no-ssr/FronteggProviderNoSSR.js.map +1 -1
- package/no-ssr/NoSSRStoreHolder.js +1 -5
- package/no-ssr/NoSSRStoreHolder.js.map +1 -1
- package/package.json +4 -4
- package/pages/FronteggRouter/FronteggRouter.d.ts +2 -1
- package/pages/helpers.d.ts +0 -1
- package/pages/withFronteggApp/withFronteggApp.js +1 -2
- package/pages/withFronteggApp/withFronteggApp.js.map +1 -1
- package/sdkVersion.js +1 -1
- package/sdkVersion.js.map +1 -1
- package/types/index.d.ts +1 -1
- package/types/index.js.map +1 -1
- package/utils/cookies/index.d.ts +5 -1
- package/utils/cookies/index.js +2 -0
- package/utils/cookies/index.js.map +1 -1
- package/utils/cookies/types.d.ts +0 -1
- package/utils/fronteggLogger/index.js +0 -2
- package/utils/fronteggLogger/index.js.map +1 -1
- package/utils/jwt/index.js +0 -3
- package/utils/jwt/index.js.map +1 -1
- package/utils/useOnRedirectTo/index.d.ts +1 -1
- package/utils/useOnRedirectTo/index.js.map +1 -1
|
@@ -9,4 +9,4 @@ import { NextResponse } from 'next/server';
|
|
|
9
9
|
* @returns {NextResponse} redirects to login page
|
|
10
10
|
*
|
|
11
11
|
*/
|
|
12
|
-
export declare const redirectToLogin: (pathname: string, searchParams?: URLSearchParams, baseUrl?: string) => NextResponse
|
|
12
|
+
export declare const redirectToLogin: (pathname: string, searchParams?: URLSearchParams, baseUrl?: string) => NextResponse<unknown>;
|
|
@@ -18,5 +18,5 @@ interface ByPassOptions {
|
|
|
18
18
|
* - api/frontegg (API frontegg middleware)
|
|
19
19
|
* - account/[login|logout|saml/callback|...] (frontegg authentication routes)
|
|
20
20
|
*/
|
|
21
|
-
export declare const shouldByPassMiddleware: (pathname: string, headers: NextRequest[
|
|
21
|
+
export declare const shouldByPassMiddleware: (pathname: string, headers: NextRequest["headers"], options?: ByPassOptions) => boolean;
|
|
22
22
|
export {};
|
package/index.js
CHANGED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Type declaration for iron-session/edge to avoid pulling in broken package types */
|
|
2
|
+
declare module 'iron-session/edge' {
|
|
3
|
+
type PasswordOption = string | Record<string, string>;
|
|
4
|
+
export function unsealData<T>(seal: string, options: { password: PasswordOption }): Promise<T>;
|
|
5
|
+
export function sealData(data: unknown, options: { password: PasswordOption; ttl?: number }): Promise<string>;
|
|
6
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @see https://www.npmjs.com/package/http-proxy
|
|
3
3
|
*/
|
|
4
|
-
export declare const FronteggProxy: import("http-proxy")
|
|
4
|
+
export declare const FronteggProxy: import("http-proxy")<import("http").IncomingMessage, import("http").ServerResponse<import("http").IncomingMessage>>;
|
package/middleware/helpers.d.ts
CHANGED
|
@@ -39,5 +39,5 @@ export declare const extractAccessToken: (bodyStr: string) => Tokens;
|
|
|
39
39
|
* Removes the signature from the JWT token
|
|
40
40
|
* @param body
|
|
41
41
|
*/
|
|
42
|
-
export declare const removeJwtSignatureFrom: <T extends
|
|
42
|
+
export declare const removeJwtSignatureFrom: <T extends any>(body: any) => T;
|
|
43
43
|
export declare const isInternalRequest: (host: string) => boolean;
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export default function ExpireInListener(): React.JSX.Element;
|
|
@@ -12,8 +12,7 @@ var _reactHooks = require("@frontegg/react-hooks");
|
|
|
12
12
|
var _common = require("../utils/common");
|
|
13
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
14
|
var _Fragment;
|
|
15
|
-
function
|
|
16
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
15
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
17
16
|
function ExpireInListener() {
|
|
18
17
|
const user = (0, _reactHooks.useAuthUserOrNull)();
|
|
19
18
|
const actions = (0, _reactHooks.useAuthActions)();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpireInListener.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","default","ExpireInListener","_extends2","_react","_interopRequireWildcard","_reactHooks","_common","_jsxRuntime","_Fragment","
|
|
1
|
+
{"version":3,"file":"ExpireInListener.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","default","ExpireInListener","_extends2","_react","_interopRequireWildcard","_reactHooks","_common","_jsxRuntime","_Fragment","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","user","useAuthUserOrNull","actions","useAuthActions","useEffect","expiresIn","setUser","calculateExpiresInFromExp","jsx","Fragment"],"sources":["../../../../packages/nextjs/src/no-ssr/ExpireInListener.tsx"],"sourcesContent":["'use client';\n\nimport React, { useEffect } from 'react';\nimport { useAuthActions, useAuthUserOrNull } from '@frontegg/react-hooks';\nimport { calculateExpiresInFromExp } from '../utils/common';\n\nexport default function ExpireInListener() {\n const user = useAuthUserOrNull();\n const actions = useAuthActions();\n useEffect(() => {\n if (user && user?.expiresIn == null) {\n actions.setUser({\n ...user,\n expiresIn: calculateExpiresInFromExp((user as any)['exp']),\n });\n }\n }, [actions, user]);\n // eslint-disable-next-line react/jsx-no-useless-fragment\n return <></>;\n}\n"],"mappings":";AAAA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,OAAA,GAAAC,gBAAA;AAAA,IAAAC,SAAA,GAAAR,sBAAA,CAA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AAO,GAAG,IAAAC,0BAAc,EAAC,CAAC;EAChC,IAAAC,gBAAS,EAAC,MAAM;IACd,IAAIJ,IAAI,IAAI,CAAAA,IAAI,oBAAJA,IAAI,CAAEK,SAAS,KAAI,IAAI,EAAE;MACnCH,OAAO,CAACI,OAAO,KAAA7B,SAAA,CAAAF,OAAA,MACVyB,IAAI;QACPK,SAAS,EAAE,IAAAE,iCAAyB,EAAEP,IAAI,CAAS,KAAK,CAAC;MAAC,EAC3D,CAAC;IACJ;EACF,CAAC,EAAE,CAACE,OAAO,EAAEF,IAAI,CAAC,CAAC;EACnB;EACA,OAAAjB,SAAA,KAAAA,SAAA,gBAAO,IAAAD,WAAA,CAAA0B,GAAA,EAAA1B,WAAA,CAAA2B,QAAA,IAAI,CAAC;AACd","ignoreList":[]}
|
|
@@ -21,8 +21,7 @@ var _NoSSRStoreHolder = _interopRequireDefault(require("./NoSSRStoreHolder"));
|
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
22
|
var _ExpireInListener;
|
|
23
23
|
const _excluded = ["router", "appName", "hostedLoginBox", "customLoginBox"];
|
|
24
|
-
function
|
|
25
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
26
25
|
const Connector = _props => {
|
|
27
26
|
var _props$basename, _props$authOptions, _NoSSRStoreHolder$get;
|
|
28
27
|
const {
|
|
@@ -80,9 +79,8 @@ const Connector = _props => {
|
|
|
80
79
|
_restApi.ContextHolder.for(appName != null ? appName : 'default').setOnRedirectTo(onRedirectTo);
|
|
81
80
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_AppContext.default.Provider, {
|
|
82
81
|
value: app,
|
|
83
|
-
children: /*#__PURE__*/
|
|
84
|
-
app
|
|
85
|
-
}), {
|
|
82
|
+
children: /*#__PURE__*/_react.default.createElement(_reactHooks.FronteggStoreProvider, (0, _extends2.default)({}, props, {
|
|
83
|
+
app,
|
|
86
84
|
children: props.children
|
|
87
85
|
}))
|
|
88
86
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FronteggProviderNoSSR.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","FronteggProviderNoSSR","_extends2","_objectWithoutPropertiesLoose2","_js","_reactHooks","_restApi","_router","_react","_interopRequireWildcard","_AppContext","_useOnRedirectTo","_ExpireInListener2","_reduxStore","_NoSSRStoreHolder","_jsxRuntime","_ExpireInListener","_excluded","
|
|
1
|
+
{"version":3,"file":"FronteggProviderNoSSR.js","names":["_interopRequireDefault","require","Object","defineProperty","exports","value","FronteggProviderNoSSR","_extends2","_objectWithoutPropertiesLoose2","_js","_reactHooks","_restApi","_router","_react","_interopRequireWildcard","_AppContext","_useOnRedirectTo","_ExpireInListener2","_reduxStore","_NoSSRStoreHolder","_jsxRuntime","_ExpireInListener","_excluded","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","getOwnPropertyDescriptor","Connector","_props","_props$basename","_props$authOptions","_NoSSRStoreHolder$get","router","appName","hostedLoginBox","props","baseName","basename","basePath","storeHolderRef","useRef","onRedirectTo","useOnRedirectTo","authOptions","routes","contextOptions","requestCredentials","storeHolder","NoSSRStoreHolder","getInstance","current","sharedStore","store","createStore","context","previewMode","name","urlStrategy","builderMode","initialState","auth","app","AppHolder","_props$basename2","initialize","dispatch","type","payload","ContextHolder","for","setOnRedirectTo","jsx","Provider","children","React","createElement","FronteggStoreProvider","FronteggNextJSProvider","useRouter","jsxs","framework"],"sources":["../../../../packages/nextjs/src/no-ssr/FronteggProviderNoSSR.tsx"],"sourcesContent":["'use client';\n\nimport { AppHolder, FronteggApp, initialize } from '@frontegg/js';\nimport { FronteggStoreProvider } from '@frontegg/react-hooks';\nimport { ContextHolder, ContextOptions } from '@frontegg/rest-api';\nimport { FronteggAppOptions } from '@frontegg/types';\nimport { NextRouter, useRouter } from 'next/router';\nimport React, { FC, PropsWithChildren, ReactNode, useEffect, useRef } from 'react';\nimport AppContext from '../common/AppContext';\nimport useOnRedirectTo from '../utils/useOnRedirectTo';\nimport ExpireInListener from './ExpireInListener';\nimport { createStore, FronteggStore } from '@frontegg/redux-store';\nimport NoSSRStoreHolder from './NoSSRStoreHolder';\n\nexport type FronteggProviderNoSSRProps = PropsWithChildren<FronteggAppOptions>;\n\ntype ConnectorProps = PropsWithChildren<FronteggAppOptions> & {\n alwaysVisibleChildren?: ReactNode;\n router: NextRouter;\n appName?: string;\n};\n\nconst Connector: FC<ConnectorProps> = (_props) => {\n const { router, appName, hostedLoginBox, customLoginBox, ...props } = _props;\n const baseName = props.basename ?? router.basePath;\n const storeHolderRef = useRef<{ store?: FronteggStore }>({});\n const onRedirectTo = useOnRedirectTo(baseName, router, props.authOptions?.routes);\n\n const contextOptions: ContextOptions = {\n requestCredentials: 'include',\n ...props.contextOptions,\n };\n\n const storeHolder = NoSSRStoreHolder.getInstance() ?? storeHolderRef.current;\n let sharedStore = storeHolder.store;\n if (!sharedStore) {\n sharedStore = createStore({\n context: contextOptions,\n storeHolder,\n previewMode: props.previewMode,\n name: appName ?? 'default',\n urlStrategy: props.urlStrategy,\n builderMode: false,\n initialState: {\n auth: {\n ...props.authOptions,\n onRedirectTo,\n },\n },\n });\n storeHolder.store = sharedStore;\n storeHolderRef.current.store = sharedStore;\n }\n\n let app: FronteggApp;\n try {\n app = AppHolder.getInstance(appName ?? 'default');\n app.store = sharedStore;\n } catch (e) {\n app = initialize(\n {\n ...props,\n store: sharedStore,\n hostedLoginBox: hostedLoginBox ?? false,\n basename: props.basename ?? baseName,\n authOptions: {\n ...props.authOptions,\n onRedirectTo,\n },\n contextOptions,\n onRedirectTo,\n },\n appName ?? 'default'\n );\n app.store.dispatch({ type: 'auth/requestAuthorize', payload: true });\n }\n\n ContextHolder.for(appName ?? 'default').setOnRedirectTo(onRedirectTo);\n\n return (\n <AppContext.Provider value={app}>\n {/* React.createElement + cast: FC from @frontegg/react-hooks doesn't satisfy strict React 18 JSX typings (ReactNode vs ReactPortal). JSX would cause TS2786. */}\n {React.createElement(FronteggStoreProvider as React.ComponentType<any>, {\n ...props,\n app,\n children: props.children,\n })}\n </AppContext.Provider>\n );\n};\n\nconst FronteggNextJSProvider: FC<FronteggProviderNoSSRProps> = (props) => {\n const router = useRouter();\n\n return (\n <Connector {...props} router={router}>\n <ExpireInListener />\n {props.children}\n </Connector>\n );\n};\n\nexport const FronteggProviderNoSSR: FC<FronteggProviderNoSSRProps> = (props) => {\n return (\n <FronteggNextJSProvider {...props} framework={'nextjs'}>\n {props.children}\n </FronteggNextJSProvider>\n );\n};\n"],"mappings":";AAAA,YAAY;;AAAC,IAAAA,sBAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,cAAA,CAAAC,OAAA;EAAAC,KAAA;AAAA;AAAAD,OAAA,CAAAE,qBAAA;AAAA,IAAAC,SAAA,GAAAP,sBAAA,CAAAC,OAAA;AAAA,IAAAO,8BAAA,GAAAR,sBAAA,CAAAC,OAAA;AAEb,IAA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cAAK,CAACC,aAAa,CAACC,iCAAqB,MAAAlF,SAAA,CAAA0B,OAAA,MACrCe,KAAK;MACR0B,GAAG;MACHY,QAAQ,EAAEtC,KAAK,CAACsC;IAAQ,EACzB;EAAC,CACiB,CAAC;AAE1B,CAAC;AAED,MAAMI,sBAAsD,GAAI1C,KAAK,IAAK;EACxE,MAAMH,MAAM,GAAG,IAAA8C,iBAAS,EAAC,CAAC;EAE1B,oBACE,IAAAvE,WAAA,CAAAwE,IAAA,EAACpD,SAAS,MAAAjC,SAAA,CAAA0B,OAAA,MAAKe,KAAK;IAAEH,MAAM,EAAEA,MAAO;IAAAyC,QAAA,GAAAjE,iBAAA,KAAAA,iBAAA,gBACnC,IAAAD,WAAA,CAAAgE,GAAA,EAACnE,kBAAA,CAAAgB,OAAgB,IAAE,CAAC,GACnBe,KAAK,CAACsC,QAAQ;EAAA,EACN,CAAC;AAEhB,CAAC;AAEM,MAAMhF,qBAAqD,GAAI0C,KAAK,IAAK;EAC9E,oBACE,IAAA5B,WAAA,CAAAgE,GAAA,EAACM,sBAAsB,MAAAnF,SAAA,CAAA0B,OAAA,MAAKe,KAAK;IAAE6C,SAAS,EAAE,QAAS;IAAAP,QAAA,EACpDtC,KAAK,CAACsC;EAAQ,EACO,CAAC;AAE7B,CAAC;AAAClF,OAAA,CAAAE,qBAAA,GAAAA,qBAAA","ignoreList":[]}
|
|
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
var _NoSSRStoreHolder;
|
|
8
7
|
class NoSSRStoreHolder {
|
|
9
|
-
constructor() {
|
|
10
|
-
this.store = void 0;
|
|
11
|
-
}
|
|
8
|
+
constructor() {}
|
|
12
9
|
static getInstance() {
|
|
13
10
|
if (NoSSRStoreHolder.instance === null) {
|
|
14
11
|
NoSSRStoreHolder.instance = new NoSSRStoreHolder();
|
|
@@ -16,7 +13,6 @@ class NoSSRStoreHolder {
|
|
|
16
13
|
return NoSSRStoreHolder.instance;
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
_NoSSRStoreHolder = NoSSRStoreHolder;
|
|
20
16
|
NoSSRStoreHolder.instance = null;
|
|
21
17
|
var _default = exports.default = NoSSRStoreHolder;
|
|
22
18
|
//# sourceMappingURL=NoSSRStoreHolder.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NoSSRStoreHolder.js","names":["NoSSRStoreHolder","constructor","
|
|
1
|
+
{"version":3,"file":"NoSSRStoreHolder.js","names":["NoSSRStoreHolder","constructor","getInstance","instance","_default","exports","default"],"sources":["../../../../packages/nextjs/src/no-ssr/NoSSRStoreHolder.ts"],"sourcesContent":["import { FronteggStore } from '@frontegg/redux-store';\n\nclass NoSSRStoreHolder {\n private static instance: NoSSRStoreHolder | null = null;\n store?: FronteggStore;\n\n private constructor() {}\n\n public static getInstance(): NoSSRStoreHolder {\n if (NoSSRStoreHolder.instance === null) {\n NoSSRStoreHolder.instance = new NoSSRStoreHolder();\n }\n return NoSSRStoreHolder.instance;\n }\n}\n\nexport default NoSSRStoreHolder;\n"],"mappings":";;;;;;AAEA,MAAMA,gBAAgB,CAAC;EAIbC,WAAWA,CAAA,EAAG,CAAC;EAEvB,OAAcC,WAAWA,CAAA,EAAqB;IAC5C,IAAIF,gBAAgB,CAACG,QAAQ,KAAK,IAAI,EAAE;MACtCH,gBAAgB,CAACG,QAAQ,GAAG,IAAIH,gBAAgB,CAAC,CAAC;IACpD;IACA,OAAOA,gBAAgB,CAACG,QAAQ;EAClC;AACF;AAZMH,gBAAgB,CACLG,QAAQ,GAA4B,IAAI;AAAA,IAAAC,QAAA,GAAAC,OAAA,CAAAC,OAAA,GAa1CN,gBAAgB","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@frontegg/nextjs",
|
|
3
3
|
"libName": "FronteggNextJs",
|
|
4
|
-
"version": "9.2.
|
|
4
|
+
"version": "9.2.13-alpha.22662318814",
|
|
5
5
|
"author": "Frontegg LTD",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
"lint-json": "eslint -c .eslintrc.json -o ./lint-report.json --format json --no-color ./src/**/*.{ts,tsx}"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@frontegg/js": "7.
|
|
31
|
-
"@frontegg/react-hooks": "7.
|
|
30
|
+
"@frontegg/js": "7.101.0",
|
|
31
|
+
"@frontegg/react-hooks": "7.101.0",
|
|
32
32
|
"http-proxy": "^1.18.1",
|
|
33
33
|
"iron-session": "^6.3.1",
|
|
34
|
-
"jose": "^
|
|
34
|
+
"jose": "^5.9.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"react": "^16.9.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
|
package/pages/helpers.d.ts
CHANGED
|
@@ -15,8 +15,7 @@ var _helpers = require("../../middleware/helpers");
|
|
|
15
15
|
var _shouldBypassGetInitialProps = require("./shouldBypassGetInitialProps");
|
|
16
16
|
var _fronteggLogger = _interopRequireDefault(require("../../utils/fronteggLogger"));
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
function
|
|
19
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
18
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
20
19
|
const withFronteggApp = (app, options) => {
|
|
21
20
|
const originalGetInitialProps = app.getInitialProps;
|
|
22
21
|
app.getInitialProps = async appContext => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withFronteggApp.js","names":["_react","_interopRequireDefault","require","_FronteggPagesProvider","_refreshAccessTokenIfNeeded","_interopRequireWildcard","_fetchUserData","_config","_helpers","_shouldBypassGetInitialProps","_fronteggLogger","_jsxRuntime","_getRequireWildcardCache","e","WeakMap","r","t","__esModule","default","has","get","n","__proto__","a","Object","defineProperty","getOwnPropertyDescriptor","u","hasOwnProperty","call","i","set","withFronteggApp","app","options","originalGetInitialProps","getInitialProps","appContext","_ctx$req$url","_ctx$req","_ctx$req2","ctx","router","Component","logger","fronteggLogger","child","tag","isSSG","isReady","isPreview","config","checkHostedLoginConfig","appEnvConfig","appContextSessionData","session","user","tenants","shouldBypassGetInitialProps","req","url","headers","_ctx$req$url2","_ctx$req3","debug","pageProps","_extends2","shouldRequestAuthorize","_ctx$req4","isRuntimeNextRequest","refreshAccessTokenIfNeeded","process","env","removeJwtSignatureFrom","assign","userData","fetchUserData","getSession","getHeaders","_ctx$req$headers","_ctx$req5","_userData","CustomFronteggApp","appProps","activeTenant","envAppUrl","envBaseUrl","envClientId","secureJwtEnabled","envAppId","envHostedLoginBox","jsx","hostedLoginBox","__N_SSG","children","exports"],"sources":["../../../../../packages/nextjs/src/pages/withFronteggApp/withFronteggApp.tsx"],"sourcesContent":["import React from 'react';\nimport type { AppContext, AppInitialProps, AppProps } from 'next/app';\nimport type { FronteggCustomAppClass, FronteggCustomApp, WithFronteggAppOptions } from './types';\nimport FronteggProvider from '../FronteggPagesProvider';\nimport refreshAccessTokenIfNeeded, { isRuntimeNextRequest } from '../../utils/refreshAccessTokenIfNeeded';\nimport fetchUserData from '../../utils/fetchUserData';\nimport config from '../../config';\nimport { AllUserData } from '../../types';\nimport { removeJwtSignatureFrom } from '../../middleware/helpers';\nimport { shouldBypassGetInitialProps } from './shouldBypassGetInitialProps';\nimport fronteggLogger from '../../utils/fronteggLogger';\n\nexport const withFronteggApp = (app: FronteggCustomAppClass, options?: WithFronteggAppOptions): FronteggCustomApp => {\n const originalGetInitialProps = app.getInitialProps;\n\n app.getInitialProps = async (appContext: AppContext & AllUserData): Promise<AppInitialProps> => {\n const { ctx, router, Component } = appContext;\n const logger = fronteggLogger.child({ tag: 'withFronteggApp' });\n const isSSG = router.isReady == false && router.isPreview == false;\n config.checkHostedLoginConfig(options);\n\n let appEnvConfig = {};\n const appContextSessionData: AllUserData = {\n session: null,\n user: null,\n tenants: null,\n };\n if (shouldBypassGetInitialProps(ctx.req?.url ?? '/', ctx.req?.headers)) {\n logger.debug('Bypassing get initial props for url: ' + (ctx.req?.url ?? ''));\n return {\n pageProps: {\n ...(originalGetInitialProps ? await originalGetInitialProps(appContext) : {}),\n ...(Component.getInitialProps ? await Component.getInitialProps(ctx) : {}),\n },\n };\n }\n\n let shouldRequestAuthorize = false;\n\n if (ctx.req) {\n appEnvConfig = config.appEnvConfig;\n\n if (isSSG) {\n shouldRequestAuthorize = true;\n } else {\n const url = ctx.req?.url;\n\n if (url && isRuntimeNextRequest(url)) {\n let session = await refreshAccessTokenIfNeeded(ctx);\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true') {\n session = removeJwtSignatureFrom(session);\n }\n Object.assign(appContextSessionData, { session });\n } else {\n let userData = await fetchUserData({\n getSession: async () => await refreshAccessTokenIfNeeded(ctx),\n getHeaders: async () => ctx.req?.headers ?? {},\n });\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true' && userData) {\n userData = removeJwtSignatureFrom(userData);\n userData.session = removeJwtSignatureFrom(userData?.session);\n }\n shouldRequestAuthorize = true;\n Object.assign(appContextSessionData, userData);\n }\n }\n }\n\n Object.assign(appContext, appContextSessionData);\n\n return {\n pageProps: {\n ...(originalGetInitialProps ? await originalGetInitialProps(appContext) : {}),\n ...(Component.getInitialProps ? await Component.getInitialProps(ctx) : {}),\n ...(appContextSessionData.session == null ? {} : appContextSessionData),\n ...appEnvConfig,\n shouldRequestAuthorize,\n },\n };\n };\n\n function CustomFronteggApp(appProps: AppProps) {\n const {\n user,\n tenants,\n activeTenant,\n session,\n envAppUrl,\n envBaseUrl,\n envClientId,\n secureJwtEnabled,\n envAppId,\n envHostedLoginBox,\n shouldRequestAuthorize,\n } = appProps.pageProps;\n\n return (\n <FronteggProvider\n {...options}\n hostedLoginBox={envHostedLoginBox}\n {...{\n user,\n tenants,\n activeTenant,\n session,\n envAppUrl,\n envBaseUrl,\n envHostedLoginBox,\n secureJwtEnabled,\n shouldRequestAuthorize,\n isSSG: appProps.__N_SSG,\n envClientId,\n envAppId,\n }}\n >\n {app(appProps) as any}\n </FronteggProvider>\n );\n }\n\n CustomFronteggApp.getInitialProps = app.getInitialProps;\n\n return CustomFronteggApp as FronteggCustomApp;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,2BAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,4BAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAwD,I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AACa,OAAA,CAAA/D,eAAA,GAAAA,eAAA","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"withFronteggApp.js","names":["_react","_interopRequireDefault","require","_FronteggPagesProvider","_refreshAccessTokenIfNeeded","_interopRequireWildcard","_fetchUserData","_config","_helpers","_shouldBypassGetInitialProps","_fronteggLogger","_jsxRuntime","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","withFronteggApp","app","options","originalGetInitialProps","getInitialProps","appContext","_ctx$req$url","_ctx$req","_ctx$req2","ctx","router","Component","logger","fronteggLogger","child","tag","isSSG","isReady","isPreview","config","checkHostedLoginConfig","appEnvConfig","appContextSessionData","session","user","tenants","shouldBypassGetInitialProps","req","url","headers","_ctx$req$url2","_ctx$req3","debug","pageProps","_extends2","shouldRequestAuthorize","_ctx$req4","isRuntimeNextRequest","refreshAccessTokenIfNeeded","process","env","removeJwtSignatureFrom","assign","userData","fetchUserData","getSession","getHeaders","_ctx$req$headers","_ctx$req5","_userData","CustomFronteggApp","appProps","activeTenant","envAppUrl","envBaseUrl","envClientId","secureJwtEnabled","envAppId","envHostedLoginBox","jsx","hostedLoginBox","__N_SSG","children","exports"],"sources":["../../../../../packages/nextjs/src/pages/withFronteggApp/withFronteggApp.tsx"],"sourcesContent":["import React from 'react';\nimport type { AppContext, AppInitialProps, AppProps } from 'next/app';\nimport type { FronteggCustomAppClass, FronteggCustomApp, WithFronteggAppOptions } from './types';\nimport FronteggProvider from '../FronteggPagesProvider';\nimport refreshAccessTokenIfNeeded, { isRuntimeNextRequest } from '../../utils/refreshAccessTokenIfNeeded';\nimport fetchUserData from '../../utils/fetchUserData';\nimport config from '../../config';\nimport { AllUserData } from '../../types';\nimport { removeJwtSignatureFrom } from '../../middleware/helpers';\nimport { shouldBypassGetInitialProps } from './shouldBypassGetInitialProps';\nimport fronteggLogger from '../../utils/fronteggLogger';\n\nexport const withFronteggApp = (app: FronteggCustomAppClass, options?: WithFronteggAppOptions): FronteggCustomApp => {\n const originalGetInitialProps = app.getInitialProps;\n\n app.getInitialProps = async (appContext: AppContext & AllUserData): Promise<AppInitialProps> => {\n const { ctx, router, Component } = appContext;\n const logger = fronteggLogger.child({ tag: 'withFronteggApp' });\n const isSSG = router.isReady == false && router.isPreview == false;\n config.checkHostedLoginConfig(options);\n\n let appEnvConfig = {};\n const appContextSessionData: AllUserData = {\n session: null,\n user: null,\n tenants: null,\n };\n if (shouldBypassGetInitialProps(ctx.req?.url ?? '/', ctx.req?.headers)) {\n logger.debug('Bypassing get initial props for url: ' + (ctx.req?.url ?? ''));\n return {\n pageProps: {\n ...(originalGetInitialProps ? await originalGetInitialProps(appContext) : {}),\n ...(Component.getInitialProps ? await Component.getInitialProps(ctx) : {}),\n },\n };\n }\n\n let shouldRequestAuthorize = false;\n\n if (ctx.req) {\n appEnvConfig = config.appEnvConfig;\n\n if (isSSG) {\n shouldRequestAuthorize = true;\n } else {\n const url = ctx.req?.url;\n\n if (url && isRuntimeNextRequest(url)) {\n let session = await refreshAccessTokenIfNeeded(ctx);\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true') {\n session = removeJwtSignatureFrom(session);\n }\n Object.assign(appContextSessionData, { session });\n } else {\n let userData = await fetchUserData({\n getSession: async () => await refreshAccessTokenIfNeeded(ctx),\n getHeaders: async () => ctx.req?.headers ?? {},\n });\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true' && userData) {\n userData = removeJwtSignatureFrom(userData);\n userData.session = removeJwtSignatureFrom(userData?.session);\n }\n shouldRequestAuthorize = true;\n Object.assign(appContextSessionData, userData);\n }\n }\n }\n\n Object.assign(appContext, appContextSessionData);\n\n return {\n pageProps: {\n ...(originalGetInitialProps ? await originalGetInitialProps(appContext) : {}),\n ...(Component.getInitialProps ? await Component.getInitialProps(ctx) : {}),\n ...(appContextSessionData.session == null ? {} : appContextSessionData),\n ...appEnvConfig,\n shouldRequestAuthorize,\n },\n };\n };\n\n function CustomFronteggApp(appProps: AppProps) {\n const {\n user,\n tenants,\n activeTenant,\n session,\n envAppUrl,\n envBaseUrl,\n envClientId,\n secureJwtEnabled,\n envAppId,\n envHostedLoginBox,\n shouldRequestAuthorize,\n } = appProps.pageProps;\n\n return (\n <FronteggProvider\n {...options}\n hostedLoginBox={envHostedLoginBox}\n {...{\n user,\n tenants,\n activeTenant,\n session,\n envAppUrl,\n envBaseUrl,\n envHostedLoginBox,\n secureJwtEnabled,\n shouldRequestAuthorize,\n isSSG: appProps.__N_SSG,\n envClientId,\n envAppId,\n }}\n >\n {app(appProps) as any}\n </FronteggProvider>\n );\n }\n\n CustomFronteggApp.getInitialProps = app.getInitialProps;\n\n return CustomFronteggApp as FronteggCustomApp;\n};\n"],"mappings":";;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AAGA,IAAAC,sBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,2BAAA,GAAAC,uBAAA,CAAAH,OAAA;AACA,IAAAI,cAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,OAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,QAAA,GAAAN,OAAA;AACA,IAAAO,4BAAA,GAAAP,OAAA;AACA,IAAAQ,eAAA,GAAAT,sBAAA,CAAAC,OAAA;AAAwD,IAAAS,WAAA,GAAAT,OAAA;AAAA,SAAAG,wBAAAO,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAT,uBAAA,YAAAA,CAAAO,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MA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BAAiBA,CAACC,QAAkB,EAAE;IAC7C,MAAM;MACJ3B,IAAI;MACJC,OAAO;MACP2B,YAAY;MACZ7B,OAAO;MACP8B,SAAS;MACTC,UAAU;MACVC,WAAW;MACXC,gBAAgB;MAChBC,QAAQ;MACRC,iBAAiB;MACjBvB;IACF,CAAC,GAAGgB,QAAQ,CAAClB,SAAS;IAEtB,oBACE,IAAArD,WAAA,CAAA+E,GAAA,EAACvF,sBAAA,CAAAmB,OAAgB,MAAA2C,SAAA,CAAA3C,OAAA,MACXW,OAAO;MACX0D,cAAc,EAAEF,iBAAkB;MAEhClC,IAAI;MACJC,OAAO;MACP2B,YAAY;MACZ7B,OAAO;MACP8B,SAAS;MACTC,UAAU;MACVI,iBAAiB;MACjBF,gBAAgB;MAChBrB,sBAAsB;MACtBnB,KAAK,EAAEmC,QAAQ,CAACU,OAAO;MACvBN,WAAW;MACXE,QAAQ;MAAAK,QAAA,EAGT7D,GAAG,CAACkD,QAAQ;IAAC,EACE,CAAC;EAEvB;EAEAD,iBAAiB,CAAC9C,eAAe,GAAGH,GAAG,CAACG,eAAe;EAEvD,OAAO8C,iBAAiB;AAC1B,CAAC;AAACa,OAAA,CAAA/D,eAAA,GAAAA,eAAA","ignoreList":[]}
|
package/sdkVersion.js
CHANGED
package/sdkVersion.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdkVersion.js","names":["version"],"sources":["../../../packages/nextjs/src/sdkVersion.ts"],"sourcesContent":["export default { version: '9.2.
|
|
1
|
+
{"version":3,"file":"sdkVersion.js","names":["version"],"sources":["../../../packages/nextjs/src/sdkVersion.ts"],"sourcesContent":["export default { version: '9.2.13-alpha.22662318814' };\n"],"mappings":";;;;;;iCAAe;EAAEA,OAAO,EAAE;AAA2B,CAAC","ignoreList":[]}
|
package/types/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import type { FronteggAppOptions } from '@frontegg/types';
|
|
|
2
2
|
import type { ILoginResponse, ITenantsResponse } from '@frontegg/rest-api';
|
|
3
3
|
import type { IncomingMessage } from 'http';
|
|
4
4
|
import type { ReactNode } from 'react';
|
|
5
|
-
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';
|
|
5
|
+
import type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';
|
|
6
6
|
import type { NextRouter } from 'next/router';
|
|
7
7
|
export interface EncryptionUtils {
|
|
8
8
|
unsealTokens(data: string): Promise<FronteggUserTokens | undefined>;
|
package/types/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../../../packages/nextjs/src/types/index.ts"],"sourcesContent":["import type { FronteggAppOptions } from '@frontegg/types';\nimport type { ILoginResponse, ITenantsResponse } from '@frontegg/rest-api';\nimport type { IncomingMessage } from 'http';\nimport type { ReactNode } from 'react';\nimport type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context';\nimport type { NextRouter } from 'next/router';\n\nexport interface EncryptionUtils {\n unsealTokens(data: string): Promise<FronteggUserTokens | undefined>;\n\n sealTokens(tokens: FronteggUserTokens, ttl: number): Promise<string>;\n}\n\nexport interface FronteggUserTokens {\n accessToken: string;\n refreshToken?: string;\n}\n\nexport interface FronteggNextJSSession extends FronteggUserTokens {\n user: FronteggUserSession;\n}\n\nexport interface FronteggEdgeSession {\n session?: FronteggNextJSSession;\n headers?: Record<string, string>;\n forwardedHeaders?: Headers;\n}\n\nexport type RequestType = IncomingMessage | Request;\n\nexport interface AccountEnvironment {\n id: string;\n createdAt: string;\n environment: 'production' | 'development';\n}\n\nexport interface CustomClaims {\n accountEnvironments: AccountEnvironment[];\n}\n\nexport interface AllUserData {\n user?: ILoginResponse | null;\n tenants?: ITenantsResponse[] | null;\n activeTenant?: ITenantsResponse;\n session?: FronteggNextJSSession | null;\n}\n\nexport interface FronteggUserSession {\n sub: string;\n name: string;\n email: string;\n email_verified: boolean;\n metadata: any;\n roles: string[];\n permissions: string[];\n tenantId: string;\n tenantIds: string[];\n profilePictureUrl: string;\n type: string; // \"userToken\"\n customClaims: CustomClaims;\n iat: number;\n exp: number;\n aud: string;\n iss: string;\n}\n\nexport interface FronteggProviderOptions extends Omit<FronteggAppOptions, 'contextOptions'>, AllUserData {\n envAppUrl: string;\n envBaseUrl: string;\n envClientId: string;\n shouldRequestAuthorize?: boolean;\n isSSG?: boolean;\n envAppId?: string;\n secureJwtEnabled?: boolean;\n contextOptions?: Omit<FronteggAppOptions['contextOptions'], 'baseUrl'>;\n}\n\nexport interface FronteggProviderProps extends FronteggProviderOptions {\n children?: ReactNode;\n alwaysVisibleChildren?: ReactNode;\n router: AppRouterInstance | NextRouter;\n appName?: string;\n}\n\ntype CustomLoginOptionsWithParamKeyType = {\n /**\n *The param key from your tenant login url, for 'frontegg.com?organization=[tenant]' would be 'organization'\n */\n paramKey: string;\n subDomainIndex?: never;\n};\n\ntype CustomLoginOptionsWithSubDomainType = {\n /**\n *The index of sub domain from your tenant login url, for 'https://[tenant].frontegg.com' would be 0\n */\n subDomainIndex: number;\n paramKey?: never;\n};\n\nexport type CustomLoginOptionsType = CustomLoginOptionsWithParamKeyType | CustomLoginOptionsWithSubDomainType;\n\ntype PagesDirectoryProviderProps = {\n customLoginOptions?: CustomLoginOptionsType;\n};\n\nexport type ClientFronteggProviderProps = Omit<FronteggProviderProps, 'router'> & PagesDirectoryProviderProps;\n\ndeclare module 'iron-session' {\n interface IronSessionData {\n accessToken: FronteggNextJSSession['accessToken'];\n user: FronteggNextJSSession['user'];\n }\n}\n\ndeclare global {\n var customLoginAppUrl: string | undefined;\n\n interface ProcessEnv {\n FRONTEGG_BASE_URL: string;\n PORT?: string;\n PWD: string;\n }\n}\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../../../packages/nextjs/src/types/index.ts"],"sourcesContent":["import type { FronteggAppOptions } from '@frontegg/types';\nimport type { ILoginResponse, ITenantsResponse } from '@frontegg/rest-api';\nimport type { IncomingMessage } from 'http';\nimport type { ReactNode } from 'react';\nimport type { AppRouterInstance } from 'next/dist/shared/lib/app-router-context.shared-runtime';\nimport type { NextRouter } from 'next/router';\n\nexport interface EncryptionUtils {\n unsealTokens(data: string): Promise<FronteggUserTokens | undefined>;\n\n sealTokens(tokens: FronteggUserTokens, ttl: number): Promise<string>;\n}\n\nexport interface FronteggUserTokens {\n accessToken: string;\n refreshToken?: string;\n}\n\nexport interface FronteggNextJSSession extends FronteggUserTokens {\n user: FronteggUserSession;\n}\n\nexport interface FronteggEdgeSession {\n session?: FronteggNextJSSession;\n headers?: Record<string, string>;\n forwardedHeaders?: Headers;\n}\n\nexport type RequestType = IncomingMessage | Request;\n\nexport interface AccountEnvironment {\n id: string;\n createdAt: string;\n environment: 'production' | 'development';\n}\n\nexport interface CustomClaims {\n accountEnvironments: AccountEnvironment[];\n}\n\nexport interface AllUserData {\n user?: ILoginResponse | null;\n tenants?: ITenantsResponse[] | null;\n activeTenant?: ITenantsResponse;\n session?: FronteggNextJSSession | null;\n}\n\nexport interface FronteggUserSession {\n sub: string;\n name: string;\n email: string;\n email_verified: boolean;\n metadata: any;\n roles: string[];\n permissions: string[];\n tenantId: string;\n tenantIds: string[];\n profilePictureUrl: string;\n type: string; // \"userToken\"\n customClaims: CustomClaims;\n iat: number;\n exp: number;\n aud: string;\n iss: string;\n}\n\nexport interface FronteggProviderOptions extends Omit<FronteggAppOptions, 'contextOptions'>, AllUserData {\n envAppUrl: string;\n envBaseUrl: string;\n envClientId: string;\n shouldRequestAuthorize?: boolean;\n isSSG?: boolean;\n envAppId?: string;\n secureJwtEnabled?: boolean;\n contextOptions?: Omit<FronteggAppOptions['contextOptions'], 'baseUrl'>;\n}\n\nexport interface FronteggProviderProps extends FronteggProviderOptions {\n children?: ReactNode;\n alwaysVisibleChildren?: ReactNode;\n router: AppRouterInstance | NextRouter;\n appName?: string;\n}\n\ntype CustomLoginOptionsWithParamKeyType = {\n /**\n *The param key from your tenant login url, for 'frontegg.com?organization=[tenant]' would be 'organization'\n */\n paramKey: string;\n subDomainIndex?: never;\n};\n\ntype CustomLoginOptionsWithSubDomainType = {\n /**\n *The index of sub domain from your tenant login url, for 'https://[tenant].frontegg.com' would be 0\n */\n subDomainIndex: number;\n paramKey?: never;\n};\n\nexport type CustomLoginOptionsType = CustomLoginOptionsWithParamKeyType | CustomLoginOptionsWithSubDomainType;\n\ntype PagesDirectoryProviderProps = {\n customLoginOptions?: CustomLoginOptionsType;\n};\n\nexport type ClientFronteggProviderProps = Omit<FronteggProviderProps, 'router'> & PagesDirectoryProviderProps;\n\ndeclare module 'iron-session' {\n interface IronSessionData {\n accessToken: FronteggNextJSSession['accessToken'];\n user: FronteggNextJSSession['user'];\n }\n}\n\ndeclare global {\n var customLoginAppUrl: string | undefined;\n\n interface ProcessEnv {\n FRONTEGG_BASE_URL: string;\n PORT?: string;\n PWD: string;\n }\n}\n"],"mappings":"","ignoreList":[]}
|
package/utils/cookies/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
/** Cookie shape for Next.js 14+ cookies() API compatibility */
|
|
2
|
+
interface RequestCookie {
|
|
3
|
+
name: string;
|
|
4
|
+
value: string;
|
|
5
|
+
}
|
|
2
6
|
import { CreateCookieOptions, RemoveCookiesOptions, RequestType, ResponseType } from './types';
|
|
3
7
|
declare class CookieManager {
|
|
4
8
|
getCookieName: (cookieNumber?: number, cookieName?: string) => string;
|
package/utils/cookies/index.js
CHANGED
|
@@ -10,6 +10,8 @@ var _config = _interopRequireDefault(require("../../config"));
|
|
|
10
10
|
var _constants = require("./constants");
|
|
11
11
|
var _helpers = require("./helpers");
|
|
12
12
|
var _fronteggLogger = _interopRequireDefault(require("../fronteggLogger"));
|
|
13
|
+
/** Cookie shape for Next.js 14+ cookies() API compatibility */
|
|
14
|
+
|
|
13
15
|
class CookieManager {
|
|
14
16
|
constructor() {
|
|
15
17
|
this.getCookieName = (cookieNumber, cookieName = _config.default.cookieName) => cookieNumber ? (0, _helpers.getIndexedCookieName)(cookieNumber, cookieName) : cookieName;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_serializer","_interopRequireDefault","require","_config","_constants","_helpers","_fronteggLogger","CookieManager","constructor","getCookieName","cookieNumber","cookieName","config","getIndexedCookieName","createEmptySingleCookie","isSecured","cookieDomain","create","value","expires","Date","secure","domain","silent","createEmptyCookies","_cookiesToRemove","removeRefresh","allEmptyCookies","refreshTokenVariants","getRefreshTokenCookieNameVariants","cookiesToRemove","forEach","name","push","getCookiesToRemove","request","logger","fronteggLogger","child","tag","info","cookieStr","getCookieHeader","cookies","cookieSerializer","parse","cookieToRemove","length","e","error","modifySetCookie","setCookieValue","cookieRegexSplitter","cookieHeader","match","exec","cookieString","trim","startsWith","substring","map","c","cookie","split","debug","filter","property","clientId","replace","rewriteCookieByAppId","appId","toLowerCase","baseUrlHost","join","refreshTokenKey","getEmptyCookiesBeforeCreatingNew","req","newCookies","newCookieNames","indexOf","options","_options$cookieName","_options$httpOnly","_options$domain","_options$path","level","undefined","cookieValue","serializeOptions","httpOnly","path","priority","sameSite","cookieSameSite","serializedCookie","serialize","COOKIE_MAX_LENGTH","splitValueToChunks","removedCookiesValue","parseCookieHeader","getSessionCookieFromRequest","i","sessionCookies","sessionCookieChunk","getRefreshCookieFromRequestEdge","refreshCookie","Object","keys","find","getSessionCookieFromRedirectedResponse","response","getSetCookieHeader","parseCookieFromArray","cookieChunks","includes","sort","a","b","firstCookieNumber","parseInt","slice","secondCookieNumber","getRequestCookiesHeaderToRemove","cookieNames","removeCookies","res","_ref","existingSetCookie","getHeader","Array","isArray","values","setCookieHeaders","setHeader","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/cookies/index.ts"],"sourcesContent":["import cookieSerializer from './serializer';\nimport type { RequestCookie } from 'next/dist/server/web/spec-extension/cookies';\nimport config from '../../config';\nimport { CookieSerializeOptions, CreateCookieOptions, RemoveCookiesOptions, RequestType, ResponseType } from './types';\nimport { COOKIE_MAX_LENGTH } from './constants';\n\nimport {\n getCookieHeader,\n getIndexedCookieName,\n getRefreshTokenCookieNameVariants,\n getSetCookieHeader,\n splitValueToChunks,\n} from './helpers';\nimport fronteggLogger from '../fronteggLogger';\nimport { NextApiRequest } from 'next/dist/shared/lib/utils';\n\nclass CookieManager {\n getCookieName = (cookieNumber?: number, cookieName = config.cookieName) =>\n cookieNumber ? getIndexedCookieName(cookieNumber, cookieName) : cookieName;\n\n get refreshTokenKey(): string {\n if (config.rewriteCookieByAppId && config.appId) {\n return `fe_refresh_${config.appId.replace(/-/g, '')}`;\n } else {\n return `fe_refresh_${config.clientId.replace(/-/g, '')}`;\n }\n }\n\n /**\n * This function creates list of empty cookies that already exists in the request.\n * This is used for removing existing cookies before creating new ones.\n * @param {CreateCookieOptions} options - Create cookie options\n */\n getEmptyCookiesBeforeCreatingNew(\n { req, value, secure, domain }: CreateCookieOptions,\n newCookies: string[]\n ): string[] {\n if (!req || !value) {\n return [];\n }\n const newCookieNames = newCookies.map((c) => c.split('=')[0]);\n const cookiesToRemove = this.getCookiesToRemove(req).filter((cookie) => newCookieNames.indexOf(cookie) === -1);\n if (cookiesToRemove.length === 0) {\n return [];\n }\n\n return this.createEmptyCookies(secure, domain ?? config.cookieDomain, cookiesToRemove, false);\n }\n\n /**\n * Validate and create new cookie headers.\n * The default value of `cookieName` is {@link config.cookieName}\n * @param {CreateCookieOptions} options - Create cookie options\n */\n create(options: CreateCookieOptions): string[] {\n const logger = fronteggLogger.child({ tag: 'CookieManager.create', level: options.silent ? 'error' : undefined });\n const cookieName = options.cookieName ?? this.getCookieName();\n const cookieValue = options.value;\n logger.info(`Creating new cookie for '${cookieName}'`);\n\n const serializeOptions: CookieSerializeOptions = {\n expires: options.expires,\n httpOnly: options.httpOnly ?? true,\n domain: options.domain ?? config.cookieDomain,\n path: options.path ?? '/',\n priority: 'high',\n };\n\n if (options.secure) {\n logger.debug(`Set cookie '${cookieName}' as secure`);\n serializeOptions.secure = options.secure;\n serializeOptions.sameSite = config.cookieSameSite;\n }\n\n const serializedCookie = cookieSerializer.serialize(cookieName, cookieValue, serializeOptions);\n\n let newCookies: string[] = [];\n if (serializedCookie.length <= COOKIE_MAX_LENGTH) {\n logger.info(`Successfully create a cookie header, '${cookieName}'`);\n newCookies = [serializedCookie];\n } else {\n logger.debug('Going to split cookie into chunks');\n /** Create chunked cookie headers and store value as array of headers */\n const cookies = splitValueToChunks(cookieName, cookieValue, serializeOptions);\n logger.info(`Successfully create chunked cookie headers, '${cookieName}' (count: ${cookies.length})`);\n newCookies = cookies;\n }\n\n const removedCookiesValue = this.getEmptyCookiesBeforeCreatingNew(options, newCookies);\n return [...removedCookiesValue, ...newCookies];\n }\n\n /**\n * Receive incoming http request, and extract the cookie header.\n * @return cookie as string if exists, else empty string\n *\n * @param {RequestType} request - Incoming HTTP Request\n */\n parseCookieHeader(request: RequestType): Record<string, string> {\n const logger = fronteggLogger.child({ tag: 'CookieManager.parseCookieHeader' });\n\n logger.info('Going to extract all cookies header from request');\n const cookieHeader = getCookieHeader(request);\n logger.info('Parsing cookie header to map');\n return cookieSerializer.parse(cookieHeader);\n }\n\n /**\n * Loop over cookie headers, extract, parse cookies and merged divided cookies from incoming http request,\n * @return full session cookie headers if exists, else return undefined\n * @param {RequestType} request - Incoming HTTP Request\n */\n getSessionCookieFromRequest(request?: RequestType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSessionCookieFromRequest' });\n logger.info('Going to extract session cookies header from request');\n\n if (!request) {\n logger.info(`'request' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting cookie header');\n const cookieStr = getCookieHeader(request);\n\n logger.debug('Parsing cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n logger.debug('Loop over session cookie headers');\n let i = 1;\n let sessionCookies = '';\n let sessionCookieChunk: string | undefined = cookies[this.getCookieName()];\n if (sessionCookieChunk === undefined) {\n do {\n sessionCookieChunk = cookies[getIndexedCookieName(i++)];\n if (sessionCookieChunk) {\n sessionCookies += sessionCookieChunk;\n }\n } while (sessionCookieChunk);\n } else {\n sessionCookies = sessionCookieChunk;\n }\n\n if (sessionCookies.length === 0) {\n logger.info('Session cookie NOT found');\n return undefined;\n }\n\n logger.info(`Session cookie found, (count: ${sessionCookies.length})`);\n return sessionCookies;\n }\n\n getRefreshCookieFromRequestEdge(request?: RequestType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getRefreshCookieFromRequest' });\n logger.info('Going to extract refresh cookie header from request');\n\n if (!request) {\n logger.info(`'request' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting cookie header');\n const cookieStr = getCookieHeader(request);\n\n logger.debug('Parsing cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n const refreshTokenKey = this.refreshTokenKey;\n const refreshCookie = Object.keys(cookies).find((cookie) => {\n return cookie.replace(/-/g, '') === refreshTokenKey;\n });\n\n if (!refreshCookie) {\n logger.info('Refresh cookie NOT found');\n return undefined;\n }\n\n logger.info(`Refresh cookie found for key: ${refreshTokenKey}`);\n return cookies[refreshCookie];\n }\n\n /**\n * Loop over cookie headers, extract, parse cookies and merged divided cookies from redirected http response,\n * @return full session cookie headers if exists, else return undefined\n * @param {ResponseType} response - Outgoing HTTP response\n */\n getSessionCookieFromRedirectedResponse(response?: ResponseType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSessionCookieFromRedirectedResponse' });\n logger.info('Going to extract session from set-cookie header from response');\n\n if (!response) {\n logger.info(`'response' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting set-cookie header');\n const cookieStr = getSetCookieHeader(response);\n\n logger.debug('Parsing set-cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n logger.debug('Loop over session set-cookie header');\n let i = 1;\n let sessionCookies = '';\n let sessionCookieChunk: string | undefined = cookies[this.getCookieName()];\n if (sessionCookieChunk === undefined) {\n do {\n sessionCookieChunk = cookies[getIndexedCookieName(i++)];\n if (sessionCookieChunk) {\n sessionCookies += sessionCookieChunk;\n }\n } while (sessionCookieChunk);\n } else {\n sessionCookies = sessionCookieChunk;\n }\n\n if (sessionCookies.length === 0) {\n logger.info('Session set-cookie NOT found');\n return undefined;\n }\n\n logger.info(`Session set-cookie found, (count: ${sessionCookies.length})`);\n return sessionCookies;\n }\n\n parseCookieFromArray(cookies: RequestCookie[]): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.parseCookieFromArray' });\n const cookieChunks = cookies.filter((c) => c.name.includes(this.getCookieName()));\n logger.info('Parsing session cookie from RequestCookie for Next.JS 13+');\n\n if (!cookieChunks || cookieChunks.length === 0) {\n logger.info(`No session cookies found`);\n return undefined;\n }\n logger.debug(`Found ${cookieChunks.length} chunks`);\n cookieChunks.sort((a, b) => {\n const firstCookieNumber = parseInt(a.name.slice(-1));\n const secondCookieNumber = parseInt(b.name.slice(-1));\n return firstCookieNumber > secondCookieNumber ? 1 : -1;\n });\n\n logger.info(`Concatenate session cookies chunks`);\n return cookieChunks.map((c) => c.value).join('');\n }\n\n private createEmptySingleCookie = (cookieName: string, isSecured: boolean, cookieDomain: string) => {\n return this.create({\n cookieName,\n value: '',\n expires: new Date(),\n secure: isSecured,\n domain: cookieDomain,\n silent: true,\n });\n };\n\n createEmptyCookies = (\n isSecured: boolean,\n cookieDomain: string,\n _cookiesToRemove: string[],\n removeRefresh = true\n ): string[] => {\n const allEmptyCookies: string[] = [];\n\n const refreshTokenVariants = getRefreshTokenCookieNameVariants();\n const cookiesToRemove = [..._cookiesToRemove, ...(removeRefresh ? refreshTokenVariants : [])];\n\n cookiesToRemove.forEach((name: string) => {\n allEmptyCookies.push(...this.createEmptySingleCookie(name, isSecured, cookieDomain));\n });\n\n return allEmptyCookies;\n };\n\n private getCookiesToRemove = (request?: RequestType): string[] => {\n const logger = fronteggLogger.child({ tag: 'getCookiesToRemove' });\n if (!request) {\n return [];\n }\n try {\n logger.info('extract cookie from request headers');\n const cookieStr = getCookieHeader(request);\n const cookies = cookieStr && cookieSerializer.parse(cookieStr);\n if (!cookies) {\n return [];\n }\n let cookieNumber = 1;\n const cookieToRemove = [];\n if (cookies[this.getCookieName()]) {\n cookieToRemove.push(this.getCookieName());\n }\n while (cookies[this.getCookieName(cookieNumber)]) {\n cookieToRemove.push(this.getCookieName(cookieNumber));\n cookieNumber++;\n }\n logger.info(`number of cookies to remove: ${cookieToRemove.length}`);\n return cookieToRemove;\n } catch (e) {\n logger.error(e);\n return [];\n }\n };\n\n /**\n * Take a list of cookieNames and return the headers to remove the cookies from the client side\n * @param {RemoveCookiesOptions} setCookieValue\n */\n getRequestCookiesHeaderToRemove({\n cookieNames,\n isSecured,\n cookieDomain,\n req,\n }: Omit<RemoveCookiesOptions, 'res'>): string[] {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSetCookiesHeaderToRemove' });\n logger.debug('Setting empty cookie headers remove cookies from client side');\n const cookiesToRemove = this.getCookiesToRemove(req);\n const cookieValue = this.createEmptyCookies(isSecured, cookieDomain, cookieNames ?? cookiesToRemove);\n return [...cookieValue];\n }\n\n /**\n * Take a list of cookieNames and modify request/response headers\n * to proxy the cookies from Next.js to Frontegg Services and vice-versa\n * @param {RemoveCookiesOptions} setCookieValue\n */\n removeCookies({ cookieNames, isSecured, cookieDomain, res, req }: RemoveCookiesOptions): void {\n const logger = fronteggLogger.child({ tag: 'CookieManager.removeCookies' });\n const cookieValue = this.getRequestCookiesHeaderToRemove({ cookieNames, isSecured, cookieDomain, req });\n\n let existingSetCookie = (res.getHeader('set-cookie') as string[] | string) ?? [];\n if (existingSetCookie != null && typeof existingSetCookie === 'object' && !Array.isArray(existingSetCookie)) {\n existingSetCookie = Object.values(existingSetCookie);\n }\n if (typeof existingSetCookie === 'string') {\n existingSetCookie = [existingSetCookie];\n }\n const setCookieHeaders = [...existingSetCookie, ...cookieValue];\n\n logger.debug(`removing headers (count: ${setCookieHeaders.length})`);\n res.setHeader('set-cookie', setCookieHeaders);\n }\n\n /**\n * Take a list of cookie headers and modify the Domain / Secure / SameSite\n * to proxy the cookies to Frontegg Services and vice-versa\n * @param {string[]} setCookieValue - list of cookies to modify\n * @param {boolean} isSecured - if the running application behind SSL\n */\n modifySetCookie = (setCookieValue: string[] | undefined, isSecured: boolean): string[] | undefined => {\n const logger = fronteggLogger.child({ tag: 'CookieManager.modifySetCookie' });\n if (!setCookieValue || setCookieValue.length === 0) {\n logger.info(`No headers to modify`);\n return setCookieValue;\n }\n\n // noinspection SuspiciousTypeOfGuard\n if (typeof setCookieValue === 'string') {\n const cookieRegexSplitter = /(.*?;.*?(?:Expires=[^;]+;.*?)?(?=,\\s*\\S+=|$))/g;\n const cookies = [];\n const cookieHeader = `${setCookieValue}`;\n let match;\n while ((match = cookieRegexSplitter.exec(cookieHeader)) !== null) {\n let cookieString = match[1].trim();\n if (cookieString.startsWith(',')) {\n cookies.push(cookieString.substring(1).trim());\n } else {\n cookies.push(cookieString);\n }\n }\n setCookieValue = cookies;\n }\n\n logger.info(`modifying cookie headers (count: ${setCookieValue.length})`);\n return setCookieValue.map((c) => {\n let cookie = c.split('; ');\n\n logger.debug(`modifying cookie ${cookie[0]}, isSecured: ${isSecured}`);\n if (!isSecured) {\n cookie = cookie.filter((property) => property !== 'Secure' && property !== 'SameSite=None');\n }\n\n return (\n cookie\n .map((property) => {\n if (property.trim().startsWith(`fe_refresh_${config.clientId.replace('-', '')}`)) {\n if (config.rewriteCookieByAppId && config.appId) {\n return property.replace(\n `fe_refresh_${config.clientId.replace('-', '')}`,\n `fe_refresh_${config.appId.replace('-', '')}`\n );\n } else {\n return property;\n }\n } else if (property.toLowerCase() === `domain=${config.baseUrlHost}`) {\n return `Domain=${config.cookieDomain}`;\n } else {\n return property;\n }\n })\n .join(';') + ';'\n );\n });\n };\n}\n\nexport default new CookieManager();\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAEA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,O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c,IAAIjI,aAAa,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"index.js","names":["_serializer","_interopRequireDefault","require","_config","_constants","_helpers","_fronteggLogger","CookieManager","constructor","getCookieName","cookieNumber","cookieName","config","getIndexedCookieName","createEmptySingleCookie","isSecured","cookieDomain","create","value","expires","Date","secure","domain","silent","createEmptyCookies","_cookiesToRemove","removeRefresh","allEmptyCookies","refreshTokenVariants","getRefreshTokenCookieNameVariants","cookiesToRemove","forEach","name","push","getCookiesToRemove","request","logger","fronteggLogger","child","tag","info","cookieStr","getCookieHeader","cookies","cookieSerializer","parse","cookieToRemove","length","e","error","modifySetCookie","setCookieValue","cookieRegexSplitter","cookieHeader","match","exec","cookieString","trim","startsWith","substring","map","c","cookie","split","debug","filter","property","clientId","replace","rewriteCookieByAppId","appId","toLowerCase","baseUrlHost","join","refreshTokenKey","getEmptyCookiesBeforeCreatingNew","req","newCookies","newCookieNames","indexOf","options","_options$cookieName","_options$httpOnly","_options$domain","_options$path","level","undefined","cookieValue","serializeOptions","httpOnly","path","priority","sameSite","cookieSameSite","serializedCookie","serialize","COOKIE_MAX_LENGTH","splitValueToChunks","removedCookiesValue","parseCookieHeader","getSessionCookieFromRequest","i","sessionCookies","sessionCookieChunk","getRefreshCookieFromRequestEdge","refreshCookie","Object","keys","find","getSessionCookieFromRedirectedResponse","response","getSetCookieHeader","parseCookieFromArray","cookieChunks","includes","sort","a","b","firstCookieNumber","parseInt","slice","secondCookieNumber","getRequestCookiesHeaderToRemove","cookieNames","removeCookies","res","_ref","existingSetCookie","getHeader","Array","isArray","values","setCookieHeaders","setHeader","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/cookies/index.ts"],"sourcesContent":["import cookieSerializer from './serializer';\n/** Cookie shape for Next.js 14+ cookies() API compatibility */\ninterface RequestCookie {\n name: string;\n value: string;\n}\nimport config from '../../config';\nimport { CookieSerializeOptions, CreateCookieOptions, RemoveCookiesOptions, RequestType, ResponseType } from './types';\nimport { COOKIE_MAX_LENGTH } from './constants';\n\nimport {\n getCookieHeader,\n getIndexedCookieName,\n getRefreshTokenCookieNameVariants,\n getSetCookieHeader,\n splitValueToChunks,\n} from './helpers';\nimport fronteggLogger from '../fronteggLogger';\nimport { NextApiRequest } from 'next/dist/shared/lib/utils';\n\nclass CookieManager {\n getCookieName = (cookieNumber?: number, cookieName = config.cookieName) =>\n cookieNumber ? getIndexedCookieName(cookieNumber, cookieName) : cookieName;\n\n get refreshTokenKey(): string {\n if (config.rewriteCookieByAppId && config.appId) {\n return `fe_refresh_${config.appId.replace(/-/g, '')}`;\n } else {\n return `fe_refresh_${config.clientId.replace(/-/g, '')}`;\n }\n }\n\n /**\n * This function creates list of empty cookies that already exists in the request.\n * This is used for removing existing cookies before creating new ones.\n * @param {CreateCookieOptions} options - Create cookie options\n */\n getEmptyCookiesBeforeCreatingNew(\n { req, value, secure, domain }: CreateCookieOptions,\n newCookies: string[]\n ): string[] {\n if (!req || !value) {\n return [];\n }\n const newCookieNames = newCookies.map((c) => c.split('=')[0]);\n const cookiesToRemove = this.getCookiesToRemove(req).filter((cookie) => newCookieNames.indexOf(cookie) === -1);\n if (cookiesToRemove.length === 0) {\n return [];\n }\n\n return this.createEmptyCookies(secure, domain ?? config.cookieDomain, cookiesToRemove, false);\n }\n\n /**\n * Validate and create new cookie headers.\n * The default value of `cookieName` is {@link config.cookieName}\n * @param {CreateCookieOptions} options - Create cookie options\n */\n create(options: CreateCookieOptions): string[] {\n const logger = fronteggLogger.child({ tag: 'CookieManager.create', level: options.silent ? 'error' : undefined });\n const cookieName = options.cookieName ?? this.getCookieName();\n const cookieValue = options.value;\n logger.info(`Creating new cookie for '${cookieName}'`);\n\n const serializeOptions: CookieSerializeOptions = {\n expires: options.expires,\n httpOnly: options.httpOnly ?? true,\n domain: options.domain ?? config.cookieDomain,\n path: options.path ?? '/',\n priority: 'high',\n };\n\n if (options.secure) {\n logger.debug(`Set cookie '${cookieName}' as secure`);\n serializeOptions.secure = options.secure;\n serializeOptions.sameSite = config.cookieSameSite;\n }\n\n const serializedCookie = cookieSerializer.serialize(cookieName, cookieValue, serializeOptions);\n\n let newCookies: string[] = [];\n if (serializedCookie.length <= COOKIE_MAX_LENGTH) {\n logger.info(`Successfully create a cookie header, '${cookieName}'`);\n newCookies = [serializedCookie];\n } else {\n logger.debug('Going to split cookie into chunks');\n /** Create chunked cookie headers and store value as array of headers */\n const cookies = splitValueToChunks(cookieName, cookieValue, serializeOptions);\n logger.info(`Successfully create chunked cookie headers, '${cookieName}' (count: ${cookies.length})`);\n newCookies = cookies;\n }\n\n const removedCookiesValue = this.getEmptyCookiesBeforeCreatingNew(options, newCookies);\n return [...removedCookiesValue, ...newCookies];\n }\n\n /**\n * Receive incoming http request, and extract the cookie header.\n * @return cookie as string if exists, else empty string\n *\n * @param {RequestType} request - Incoming HTTP Request\n */\n parseCookieHeader(request: RequestType): Record<string, string> {\n const logger = fronteggLogger.child({ tag: 'CookieManager.parseCookieHeader' });\n\n logger.info('Going to extract all cookies header from request');\n const cookieHeader = getCookieHeader(request);\n logger.info('Parsing cookie header to map');\n return cookieSerializer.parse(cookieHeader);\n }\n\n /**\n * Loop over cookie headers, extract, parse cookies and merged divided cookies from incoming http request,\n * @return full session cookie headers if exists, else return undefined\n * @param {RequestType} request - Incoming HTTP Request\n */\n getSessionCookieFromRequest(request?: RequestType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSessionCookieFromRequest' });\n logger.info('Going to extract session cookies header from request');\n\n if (!request) {\n logger.info(`'request' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting cookie header');\n const cookieStr = getCookieHeader(request);\n\n logger.debug('Parsing cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n logger.debug('Loop over session cookie headers');\n let i = 1;\n let sessionCookies = '';\n let sessionCookieChunk: string | undefined = cookies[this.getCookieName()];\n if (sessionCookieChunk === undefined) {\n do {\n sessionCookieChunk = cookies[getIndexedCookieName(i++)];\n if (sessionCookieChunk) {\n sessionCookies += sessionCookieChunk;\n }\n } while (sessionCookieChunk);\n } else {\n sessionCookies = sessionCookieChunk;\n }\n\n if (sessionCookies.length === 0) {\n logger.info('Session cookie NOT found');\n return undefined;\n }\n\n logger.info(`Session cookie found, (count: ${sessionCookies.length})`);\n return sessionCookies;\n }\n\n getRefreshCookieFromRequestEdge(request?: RequestType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getRefreshCookieFromRequest' });\n logger.info('Going to extract refresh cookie header from request');\n\n if (!request) {\n logger.info(`'request' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting cookie header');\n const cookieStr = getCookieHeader(request);\n\n logger.debug('Parsing cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n const refreshTokenKey = this.refreshTokenKey;\n const refreshCookie = Object.keys(cookies).find((cookie) => {\n return cookie.replace(/-/g, '') === refreshTokenKey;\n });\n\n if (!refreshCookie) {\n logger.info('Refresh cookie NOT found');\n return undefined;\n }\n\n logger.info(`Refresh cookie found for key: ${refreshTokenKey}`);\n return cookies[refreshCookie];\n }\n\n /**\n * Loop over cookie headers, extract, parse cookies and merged divided cookies from redirected http response,\n * @return full session cookie headers if exists, else return undefined\n * @param {ResponseType} response - Outgoing HTTP response\n */\n getSessionCookieFromRedirectedResponse(response?: ResponseType): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSessionCookieFromRedirectedResponse' });\n logger.info('Going to extract session from set-cookie header from response');\n\n if (!response) {\n logger.info(`'response' argument is null, Cookie header not found`);\n return undefined;\n }\n\n logger.debug('Getting set-cookie header');\n const cookieStr = getSetCookieHeader(response);\n\n logger.debug('Parsing set-cookie header string');\n const cookies = cookieSerializer.parse(cookieStr);\n\n logger.debug('Loop over session set-cookie header');\n let i = 1;\n let sessionCookies = '';\n let sessionCookieChunk: string | undefined = cookies[this.getCookieName()];\n if (sessionCookieChunk === undefined) {\n do {\n sessionCookieChunk = cookies[getIndexedCookieName(i++)];\n if (sessionCookieChunk) {\n sessionCookies += sessionCookieChunk;\n }\n } while (sessionCookieChunk);\n } else {\n sessionCookies = sessionCookieChunk;\n }\n\n if (sessionCookies.length === 0) {\n logger.info('Session set-cookie NOT found');\n return undefined;\n }\n\n logger.info(`Session set-cookie found, (count: ${sessionCookies.length})`);\n return sessionCookies;\n }\n\n parseCookieFromArray(cookies: RequestCookie[]): string | undefined {\n const logger = fronteggLogger.child({ tag: 'CookieManager.parseCookieFromArray' });\n const cookieChunks = cookies.filter((c) => c.name.includes(this.getCookieName()));\n logger.info('Parsing session cookie from RequestCookie for Next.JS 13+');\n\n if (!cookieChunks || cookieChunks.length === 0) {\n logger.info(`No session cookies found`);\n return undefined;\n }\n logger.debug(`Found ${cookieChunks.length} chunks`);\n cookieChunks.sort((a, b) => {\n const firstCookieNumber = parseInt(a.name.slice(-1));\n const secondCookieNumber = parseInt(b.name.slice(-1));\n return firstCookieNumber > secondCookieNumber ? 1 : -1;\n });\n\n logger.info(`Concatenate session cookies chunks`);\n return cookieChunks.map((c) => c.value).join('');\n }\n\n private createEmptySingleCookie = (cookieName: string, isSecured: boolean, cookieDomain: string) => {\n return this.create({\n cookieName,\n value: '',\n expires: new Date(),\n secure: isSecured,\n domain: cookieDomain,\n silent: true,\n });\n };\n\n createEmptyCookies = (\n isSecured: boolean,\n cookieDomain: string,\n _cookiesToRemove: string[],\n removeRefresh = true\n ): string[] => {\n const allEmptyCookies: string[] = [];\n\n const refreshTokenVariants = getRefreshTokenCookieNameVariants();\n const cookiesToRemove = [..._cookiesToRemove, ...(removeRefresh ? refreshTokenVariants : [])];\n\n cookiesToRemove.forEach((name: string) => {\n allEmptyCookies.push(...this.createEmptySingleCookie(name, isSecured, cookieDomain));\n });\n\n return allEmptyCookies;\n };\n\n private getCookiesToRemove = (request?: RequestType): string[] => {\n const logger = fronteggLogger.child({ tag: 'getCookiesToRemove' });\n if (!request) {\n return [];\n }\n try {\n logger.info('extract cookie from request headers');\n const cookieStr = getCookieHeader(request);\n const cookies = cookieStr && cookieSerializer.parse(cookieStr);\n if (!cookies) {\n return [];\n }\n let cookieNumber = 1;\n const cookieToRemove = [];\n if (cookies[this.getCookieName()]) {\n cookieToRemove.push(this.getCookieName());\n }\n while (cookies[this.getCookieName(cookieNumber)]) {\n cookieToRemove.push(this.getCookieName(cookieNumber));\n cookieNumber++;\n }\n logger.info(`number of cookies to remove: ${cookieToRemove.length}`);\n return cookieToRemove;\n } catch (e) {\n logger.error(e);\n return [];\n }\n };\n\n /**\n * Take a list of cookieNames and return the headers to remove the cookies from the client side\n * @param {RemoveCookiesOptions} setCookieValue\n */\n getRequestCookiesHeaderToRemove({\n cookieNames,\n isSecured,\n cookieDomain,\n req,\n }: Omit<RemoveCookiesOptions, 'res'>): string[] {\n const logger = fronteggLogger.child({ tag: 'CookieManager.getSetCookiesHeaderToRemove' });\n logger.debug('Setting empty cookie headers remove cookies from client side');\n const cookiesToRemove = this.getCookiesToRemove(req);\n const cookieValue = this.createEmptyCookies(isSecured, cookieDomain, cookieNames ?? cookiesToRemove);\n return [...cookieValue];\n }\n\n /**\n * Take a list of cookieNames and modify request/response headers\n * to proxy the cookies from Next.js to Frontegg Services and vice-versa\n * @param {RemoveCookiesOptions} setCookieValue\n */\n removeCookies({ cookieNames, isSecured, cookieDomain, res, req }: RemoveCookiesOptions): void {\n const logger = fronteggLogger.child({ tag: 'CookieManager.removeCookies' });\n const cookieValue = this.getRequestCookiesHeaderToRemove({ cookieNames, isSecured, cookieDomain, req });\n\n let existingSetCookie = (res.getHeader('set-cookie') as string[] | string) ?? [];\n if (existingSetCookie != null && typeof existingSetCookie === 'object' && !Array.isArray(existingSetCookie)) {\n existingSetCookie = Object.values(existingSetCookie);\n }\n if (typeof existingSetCookie === 'string') {\n existingSetCookie = [existingSetCookie];\n }\n const setCookieHeaders = [...existingSetCookie, ...cookieValue];\n\n logger.debug(`removing headers (count: ${setCookieHeaders.length})`);\n res.setHeader('set-cookie', setCookieHeaders);\n }\n\n /**\n * Take a list of cookie headers and modify the Domain / Secure / SameSite\n * to proxy the cookies to Frontegg Services and vice-versa\n * @param {string[]} setCookieValue - list of cookies to modify\n * @param {boolean} isSecured - if the running application behind SSL\n */\n modifySetCookie = (setCookieValue: string[] | undefined, isSecured: boolean): string[] | undefined => {\n const logger = fronteggLogger.child({ tag: 'CookieManager.modifySetCookie' });\n if (!setCookieValue || setCookieValue.length === 0) {\n logger.info(`No headers to modify`);\n return setCookieValue;\n }\n\n // noinspection SuspiciousTypeOfGuard\n if (typeof setCookieValue === 'string') {\n const cookieRegexSplitter = /(.*?;.*?(?:Expires=[^;]+;.*?)?(?=,\\s*\\S+=|$))/g;\n const cookies = [];\n const cookieHeader = `${setCookieValue}`;\n let match;\n while ((match = cookieRegexSplitter.exec(cookieHeader)) !== null) {\n let cookieString = match[1].trim();\n if (cookieString.startsWith(',')) {\n cookies.push(cookieString.substring(1).trim());\n } else {\n cookies.push(cookieString);\n }\n }\n setCookieValue = cookies;\n }\n\n logger.info(`modifying cookie headers (count: ${setCookieValue.length})`);\n return setCookieValue.map((c) => {\n let cookie = c.split('; ');\n\n logger.debug(`modifying cookie ${cookie[0]}, isSecured: ${isSecured}`);\n if (!isSecured) {\n cookie = cookie.filter((property) => property !== 'Secure' && property !== 'SameSite=None');\n }\n\n return (\n cookie\n .map((property) => {\n if (property.trim().startsWith(`fe_refresh_${config.clientId.replace('-', '')}`)) {\n if (config.rewriteCookieByAppId && config.appId) {\n return property.replace(\n `fe_refresh_${config.clientId.replace('-', '')}`,\n `fe_refresh_${config.appId.replace('-', '')}`\n );\n } else {\n return property;\n }\n } else if (property.toLowerCase() === `domain=${config.baseUrlHost}`) {\n return `Domain=${config.cookieDomain}`;\n } else {\n return property;\n }\n })\n .join(';') + ';'\n );\n });\n };\n}\n\nexport default new CookieManager();\n"],"mappings":";;;;;;;AAAA,IAAAA,WAAA,GAAAC,sBAAA,CAAAC,OAAA;AAMA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OA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AAA,GAEc,IAAIjI,aAAa,CAAC,CAAC","ignoreList":[]}
|
package/utils/cookies/types.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ function repeat(num) {
|
|
|
27
27
|
class FronteggLogger {
|
|
28
28
|
constructor(options) {
|
|
29
29
|
var _options$level;
|
|
30
|
-
this.tag = void 0;
|
|
31
|
-
this.level = void 0;
|
|
32
30
|
if (options.tag.length > maxTagLength) {
|
|
33
31
|
this.tag = options.tag.slice(0, 7) + '...' + options.tag.slice(options.tag.length - maxTagLength + 10);
|
|
34
32
|
} else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["_constants","require","isGithubRunnerDebugMode","process","env","ACTIONS_STEP_DEBUG","ACTIONS_RUNNER_DEBUG","logLevel","FRONTEGG_LOG_LEVEL","Object","keys","LEVEL_NAMES","indexOf","maxTagLength","repeat","num","Array","map","join","FronteggLogger","constructor","options","_options$level","tag","
|
|
1
|
+
{"version":3,"file":"index.js","names":["_constants","require","isGithubRunnerDebugMode","process","env","ACTIONS_STEP_DEBUG","ACTIONS_RUNNER_DEBUG","logLevel","FRONTEGG_LOG_LEVEL","Object","keys","LEVEL_NAMES","indexOf","maxTagLength","repeat","num","Array","map","join","FronteggLogger","constructor","options","_options$level","tag","length","slice","level","prepare","printLevel","args","levelName","LEVELS","Date","toISOString","debug","console","log","apply","info","warn","error","child","_default","exports","default"],"sources":["../../../../../packages/nextjs/src/utils/fronteggLogger/index.ts"],"sourcesContent":["import { LEVEL_NAMES, LEVELS } from './constants';\n\n/**\n * @see [enabling-debug-logging](https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging)\n * in GitHub actions in failed tests for more debugging logs\n */\nconst isGithubRunnerDebugMode =\n process.env.ACTIONS_STEP_DEBUG === 'true' || process.env.ACTIONS_RUNNER_DEBUG === 'true';\n\nlet logLevel: keyof typeof LEVEL_NAMES = 'warn';\nif (process.env.FRONTEGG_LOG_LEVEL) {\n logLevel = process.env.FRONTEGG_LOG_LEVEL as keyof typeof LEVEL_NAMES;\n}\nif (isGithubRunnerDebugMode) {\n logLevel = 'debug';\n}\nif (Object.keys(LEVEL_NAMES).indexOf(logLevel) === -1) {\n logLevel = 'warn';\n}\n\ntype FronteggLoggerOptions = {\n tag: string;\n level?: keyof typeof LEVEL_NAMES;\n};\n\nconst maxTagLength = 25;\n\nfunction repeat(num: number) {\n return [...new Array(num)].map(() => ' ').join('');\n}\n\nclass FronteggLogger {\n private readonly tag: string;\n private readonly level: keyof typeof LEVEL_NAMES;\n\n constructor(options: FronteggLoggerOptions) {\n if (options.tag.length > maxTagLength) {\n this.tag = options.tag.slice(0, 7) + '...' + options.tag.slice(options.tag.length - maxTagLength + 10);\n } else {\n this.tag = repeat(maxTagLength - options.tag.length) + options.tag;\n }\n\n this.level = options.level ?? logLevel;\n }\n\n private prepare(printLevel: keyof typeof LEVEL_NAMES, args: any[]) {\n const levelName = LEVELS[LEVEL_NAMES[printLevel]];\n return [new Date().toISOString(), `|${levelName}| ${this.tag}:`, ...args];\n }\n\n debug(...args: any[]) {\n if (LEVEL_NAMES[this.level] <= LEVEL_NAMES.debug) {\n console.log.apply(console, this.prepare('debug', args));\n }\n }\n\n info(...args: any[]) {\n if (LEVEL_NAMES[this.level] <= LEVEL_NAMES.info) {\n console.info.apply(console, this.prepare('info', args));\n }\n }\n\n warn(...args: any[]) {\n if (LEVEL_NAMES[this.level] <= LEVEL_NAMES.warn) {\n console.warn.apply(console, this.prepare('warn', args));\n }\n }\n\n error(...args: any[]) {\n console.error.apply(console, this.prepare('error', args));\n }\n\n static child(options: FronteggLoggerOptions): FronteggLogger {\n return new FronteggLogger(options);\n }\n}\n\nexport default FronteggLogger;\n"],"mappings":";;;;;;AAAA,IAAAA,UAAA,GAAAC,OAAA;AAEA;AACA;AACA;AACA;AACA,MAAMC,uBAAuB,GAC3BC,OAAO,CAACC,GAAG,CAACC,kBAAkB,KAAK,MAAM,IAAIF,OAAO,CAACC,GAAG,CAACE,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