@frontegg/nextjs 9.1.2-alpha.12010090267 → 9.2.1-alpha.12031586201

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 CHANGED
@@ -1,88 +1,81 @@
1
1
  # Change Log
2
2
 
3
- ## [9.1.2](https://github.com/frontegg/frontegg-nextjs/compare/v9.1.1...v9.1.2) (2024-11-25)
3
+ ## [9.2.1](https://github.com/frontegg/frontegg-nextjs/compare/v9.2.0...v9.2.1) (2024-11-26)
4
4
 
5
+
6
+ # Change Log
7
+
8
+ ## [9.2.0](https://github.com/frontegg/frontegg-nextjs/compare/v9.1.1...v9.2.0) (2024-11-25)
9
+
5
10
  - FR-18699 - Removed entitlements automatic 30 seconds refresh mechanism
6
11
  - FR-18138 - Added logic to improve login box and admin portal stability and resiliency
7
12
  - FR-18646 - Fixed missing permissions with wildcard on custom roles
8
13
  - FR-18341 - Fixed Google Chrome Translate feature causes a crash
9
14
  - FR-16902 - Fixed login box scroll on mobile browsers
10
-
11
-
12
- ### NextJS Wrapper 9.1.2:
13
- - FR-17280 - fix next js 15 build & update example app project middleware
14
-
15
- ## [9.1.1](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.5...v9.1.1) (2024-11-12)
16
-
17
- - FR-18594 - Fixed blinking bug On IP and domain page
18
- - FR-18499 - Fixed otc page blink
19
- - FR-18005 - Fixed search api tokens with null descriptions
20
- - FR-18499 - Fixed activate with code and password
21
- - FR-18582 - Fixed loader size and wrong massage
22
-
23
-
15
+
16
+
17
+ ### NextJS Wrapper 9.2.0:
18
+ - FR-17280 - Fixed NextJS v15 build issue
19
+
20
+ ## [9.1.1](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.5...v9.1.1) (2024-11-12)
21
+
22
+ - FR-18594 - Fixed blinking bug On IP and domain page
23
+ - FR-18499 - Fixed otc page blink
24
+ - FR-18005 - Fixed search api tokens with null descriptions
25
+ - FR-18499 - Fixed activate with code and password
26
+ - FR-18582 - Fixed loader size and wrong massage
24
27
  - FR-18561 - Fixed get ip metadata when app name is provided
25
28
  - FR-17091 - Fixed long name in groups and roles
26
-
27
-
28
- - FR-18529 - Fixed empty roles field bug when appName is provided
29
-
30
-
31
- - FR-18516 - Fixed redundant function
32
- - FR-18476 - Added url for beforeRequestInterceptor function
33
-
34
-
35
- - FR-18476 - Added request interceptor
36
- - FR-18472 - Fixed Google one tap login stuck after unmounting login/signup unmounted
37
-
38
- - FR-18436 - Fixed activate account with empty redirect bug
39
-
40
-
41
- - FR-17943 - Added code pages
42
-
43
- - FR-18427 - Added Support for triggering MFA after native passkeys / iOS apple login
44
- - FR-18211 - Fixed email overlapping roles field
45
-
46
-
47
- ### NextJS Wrapper 9.1.1:
48
- - FR-17280 - fix next js 15 build & update example app project middleware
49
- - FR-18495 - refresh the token when it has expired
50
- - FR-18442 - Remove cookies when landing on oauth/callback to support after hosted login activate account succeeded
51
- - FR-18442 - Fix Nextjs session store injection and support SSG pages
52
- - Fix session abandoned when accessing not found page
53
- - Export FronteggAppRouterAsync to be imported by '@frontegg/nextjs/app'
54
-
55
- ## [9.0.5](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.4...v9.0.5) (2024-10-31)
56
-
57
- - FR-18476 - Added url for beforeRequestInterceptor function
58
-
59
-
60
- - FR-18476 - Added request interceptor
61
- - FR-18472 - Fixed Google one tap login stuck after unmounting login/signup unmounted
62
-
63
- - FR-18436 - Fixed activate account with empty redirect bug
64
-
65
-
66
- - FR-17943 - Added code pages
67
-
68
- - FR-18427 - Added Support for triggering MFA after native passkeys / iOS apple login
69
- - FR-18211 - Fixed email overlapping roles field
70
-
71
- - FR-18356 - Fixed validations localization override type
72
-
73
-
74
- ### NextJS Wrapper 9.0.5:
75
- - FR-18442 - Remove cookies when landing on oauth/callback to support after hosted login activate account succeeded
76
- - FR-18442 - Fix Nextjs session store injection and support SSG pages
77
- - Fix session abandoned when accessing not found page
78
- - Export FronteggAppRouterAsync to be imported by '@frontegg/nextjs/app'
79
- - Add Support for NextJS 15
80
-
81
- ## [9.0.4](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.3...v9.0.4) (2024-10-22)
82
-
83
- - FR-18356 - Fixed validations localization override type
84
-
85
-
29
+ - FR-18529 - Fixed empty roles field bug when appName is provided
30
+ - FR-18516 - Fixed redundant function
31
+ - FR-18476 - Added url for beforeRequestInterceptor function
32
+ - FR-18476 - Added request interceptor
33
+ - FR-18472 - Fixed Google one tap login stuck after unmounting login/signup unmounted
34
+ - FR-18436 - Fixed activate account with empty redirect bug
35
+ - FR-17943 - Added code pages
36
+ - FR-18427 - Added Support for triggering MFA after native passkeys / iOS apple login
37
+ - FR-18211 - Fixed email overlapping roles field
38
+
39
+
40
+ ### NextJS Wrapper 9.1.1:
41
+ - FR-17280 - fix next js 15 build & update example app project middleware
42
+ - FR-18495 - refresh the token when it has expired
43
+ - FR-18442 - Remove cookies when landing on oauth/callback to support after hosted login activate account succeeded
44
+ - FR-18442 - Fix Nextjs session store injection and support SSG pages
45
+ - Fix session abandoned when accessing not found page
46
+ - Export FronteggAppRouterAsync to be imported by '@frontegg/nextjs/app'
47
+
48
+ ## [9.0.5](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.4...v9.0.5) (2024-10-31)
49
+
50
+ - FR-18476 - Added url for beforeRequestInterceptor function
51
+
52
+
53
+ - FR-18476 - Added request interceptor
54
+ - FR-18472 - Fixed Google one tap login stuck after unmounting login/signup unmounted
55
+
56
+ - FR-18436 - Fixed activate account with empty redirect bug
57
+
58
+
59
+ - FR-17943 - Added code pages
60
+
61
+ - FR-18427 - Added Support for triggering MFA after native passkeys / iOS apple login
62
+ - FR-18211 - Fixed email overlapping roles field
63
+
64
+ - FR-18356 - Fixed validations localization override type
65
+
66
+
67
+ ### NextJS Wrapper 9.0.5:
68
+ - FR-18442 - Remove cookies when landing on oauth/callback to support after hosted login activate account succeeded
69
+ - FR-18442 - Fix Nextjs session store injection and support SSG pages
70
+ - Fix session abandoned when accessing not found page
71
+ - Export FronteggAppRouterAsync to be imported by '@frontegg/nextjs/app'
72
+ - Add Support for NextJS 15
73
+
74
+ ## [9.0.4](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.3...v9.0.4) (2024-10-22)
75
+
76
+ - FR-18356 - Fixed validations localization override type
77
+
78
+
86
79
  # Change Log
87
80
 
88
81
  ## [9.0.3](https://github.com/frontegg/frontegg-nextjs/compare/v9.0.2...v9.0.3) (2024-10-10)
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- /** @license Frontegg v9.1.2-alpha.12010090267
1
+ /** @license Frontegg v9.2.1-alpha.12031586201
2
2
  *
3
3
  * This source code is licensed under the MIT license found in the
4
4
  * LICENSE file in the root directory of this source tree.
@@ -1,8 +1,9 @@
1
- import type { NextApiRequest, NextApiResponse } from 'next';
1
+ import { FronteggApiMiddlewareType } from './types';
2
2
  /**
3
3
  * Next.js HTTP Proxy Middleware
4
4
  * @see https://nextjs.org/docs/api-routes/api-middlewares
5
5
  * @param {NextApiRequest} req - NextJS api request passed from api routing
6
6
  * @param {NextApiResponse} res - NextJS api response passed from api routing
7
7
  */
8
- export declare function FronteggApiMiddleware(req: NextApiRequest, res: NextApiResponse): Promise<void>;
8
+ declare const FronteggApiMiddleware: FronteggApiMiddlewareType;
9
+ export { FronteggApiMiddleware };
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.FronteggApiMiddleware = FronteggApiMiddleware;
7
+ exports.FronteggApiMiddleware = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  var _FronteggProxy = require("./FronteggProxy");
10
10
  var _constants = require("./constants");
@@ -40,7 +40,31 @@ const middlewarePromise = (req, res) => new Promise(async resolve => {
40
40
  * @param {NextApiRequest} req - NextJS api request passed from api routing
41
41
  * @param {NextApiResponse} res - NextJS api response passed from api routing
42
42
  */
43
- async function FronteggApiMiddleware(req, res) {
43
+ const FronteggApiMiddleware = async (req, res) => {
44
44
  return await middlewarePromise(req, res);
45
- }
45
+ };
46
+ exports.FronteggApiMiddleware = FronteggApiMiddleware;
47
+ FronteggApiMiddleware.cors = options => async (req, res) => {
48
+ var _req$headers$host;
49
+ const {
50
+ allowedOrigins = ['*'],
51
+ allowedMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],
52
+ allowedHeaders = ['Content-Type', 'Authorization'],
53
+ allowCredentials = true
54
+ } = options;
55
+ if ((0, _helpers.isInternalRequest)((_req$headers$host = req.headers.host) != null ? _req$headers$host : '')) {
56
+ var _req$headers$origin;
57
+ const origin = (_req$headers$origin = req.headers.origin) != null ? _req$headers$origin : '';
58
+ const combinedHeaders = Array.from(new Set([..._constants.defaultFronteggHeaders, ...allowedHeaders]));
59
+ if (allowedOrigins.includes(origin)) {
60
+ res.setHeader('Access-Control-Allow-Origin', origin);
61
+ } else {
62
+ res.removeHeader('Access-Control-Allow-Origin');
63
+ }
64
+ res.setHeader('Access-Control-Allow-Methods', allowedMethods.join(','));
65
+ res.setHeader('Access-Control-Allow-Headers', combinedHeaders.join(','));
66
+ res.setHeader('Access-Control-Allow-Credentials', allowCredentials ? 'true' : 'false');
67
+ }
68
+ return middlewarePromise(req, res);
69
+ };
46
70
  //# sourceMappingURL=FronteggApiMiddleware.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FronteggApiMiddleware.js","names":["_FronteggProxy","require","_constants","_helpers","_pages","middlewarePromise","req","res","Promise","resolve","_req$url","fronteggUrlPath","rewritePath","url","fronteggPathRewrite","rewriteUrl","fronteggSSOPathRewrite","on","options","target","process","env","headers","session","getSession","accessToken","FronteggProxy","web","_extends2","default","FronteggApiMiddleware"],"sources":["../../../../packages/nextjs/src/middleware/FronteggApiMiddleware.ts"],"sourcesContent":["import type { NextApiRequest, NextApiResponse } from 'next';\nimport { FronteggProxy } from './FronteggProxy';\nimport { fronteggSSOPathRewrite, fronteggPathRewrite } from './constants';\nimport { rewritePath } from './helpers';\nimport { getSession } from '../pages';\n\nconst middlewarePromise = (req: NextApiRequest, res: NextApiResponse) =>\n new Promise<void>(async (resolve) => {\n const fronteggUrlPath = rewritePath(req.url ?? '/', fronteggPathRewrite);\n const rewriteUrl = rewritePath(fronteggUrlPath ?? '/', fronteggSSOPathRewrite);\n req.url = rewriteUrl;\n res.on('close', () => resolve());\n const options = {\n target: process.env['FRONTEGG_BASE_URL'],\n };\n if (process.env['FRONTEGG_TEST_URL'] && req.url == '/frontegg/middleware-test') {\n options.target = process.env['FRONTEGG_TEST_URL'];\n }\n\n const headers: Record<string, string> = {};\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true') {\n const session = await getSession(req);\n if (session?.accessToken) {\n headers['authorization'] = 'Bearer ' + session.accessToken;\n }\n }\n FronteggProxy.web(req, res, {\n ...options,\n headers,\n });\n });\n\n/**\n * Next.js HTTP Proxy Middleware\n * @see https://nextjs.org/docs/api-routes/api-middlewares\n * @param {NextApiRequest} req - NextJS api request passed from api routing\n * @param {NextApiResponse} res - NextJS api response passed from api routing\n */\nexport async function FronteggApiMiddleware(req: NextApiRequest, res: NextApiResponse) {\n return await middlewarePromise(req, res);\n}\n"],"mappings":";;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAEA,MAAMI,iBAAiB,GAAGA,CAACC,GAAmB,EAAEC,GAAoB,KAClE,IAAIC,OAAO,CAAO,MAAOC,OAAO,IAAK;EAAA,IAAAC,QAAA;EACnC,MAAMC,eAAe,GAAG,IAAAC,oBAAW,GAAAF,QAAA,GAACJ,GAAG,CAACO,GAAG,YAAAH,QAAA,GAAI,GAAG,EAAEI,8BAAmB,CAAC;EACxE,MAAMC,UAAU,GAAG,IAAAH,oBAAW,EAACD,eAAe,WAAfA,eAAe,GAAI,GAAG,EAAEK,iCAAsB,CAAC;EAC9EV,GAAG,CAACO,GAAG,GAAGE,UAAU;EACpBR,GAAG,CAACU,EAAE,CAAC,OAAO,EAAE,MAAMR,OAAO,CAAC,CAAC,CAAC;EAChC,MAAMS,OAAO,GAAG;IACdC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAAC,mBAAmB;EACzC,CAAC;EACD,IAAID,OAAO,CAACC,GAAG,CAAC,mBAAmB,CAAC,IAAIf,GAAG,CAACO,GAAG,IAAI,2BAA2B,EAAE;IAC9EK,OAAO,CAACC,MAAM,GAAGC,OAAO,CAACC,GAAG,CAAC,mBAAmB,CAAC;EACnD;EAEA,MAAMC,OAA+B,GAAG,CAAC,CAAC;EAC1C,IAAIF,OAAO,CAACC,GAAG,CAAC,6BAA6B,CAAC,KAAK,MAAM,EAAE;IACzD,MAAME,OAAO,GAAG,MAAM,IAAAC,iBAAU,EAAClB,GAAG,CAAC;IACrC,IAAIiB,OAAO,YAAPA,OAAO,CAAEE,WAAW,EAAE;MACxBH,OAAO,CAAC,eAAe,CAAC,GAAG,SAAS,GAAGC,OAAO,CAACE,WAAW;IAC5D;EACF;EACAC,4BAAa,CAACC,GAAG,CAACrB,GAAG,EAAEC,GAAG,MAAAqB,SAAA,CAAAC,OAAA,MACrBX,OAAO;IACVI;EAAO,EACR,CAAC;AACJ,CAAC,CAAC;;AAEJ;AACA;AACA;AACA;AACA;AACA;AACO,eAAeQ,qBAAqBA,CAACxB,GAAmB,EAAEC,GAAoB,EAAE;EACrF,OAAO,MAAMF,iBAAiB,CAACC,GAAG,EAAEC,GAAG,CAAC;AAC1C","ignoreList":[]}
1
+ {"version":3,"file":"FronteggApiMiddleware.js","names":["_FronteggProxy","require","_constants","_helpers","_pages","middlewarePromise","req","res","Promise","resolve","_req$url","fronteggUrlPath","rewritePath","url","fronteggPathRewrite","rewriteUrl","fronteggSSOPathRewrite","on","options","target","process","env","headers","session","getSession","accessToken","FronteggProxy","web","_extends2","default","FronteggApiMiddleware","exports","cors","_req$headers$host","allowedOrigins","allowedMethods","allowedHeaders","allowCredentials","isInternalRequest","host","_req$headers$origin","origin","combinedHeaders","Array","from","Set","defaultFronteggHeaders","includes","setHeader","removeHeader","join"],"sources":["../../../../packages/nextjs/src/middleware/FronteggApiMiddleware.ts"],"sourcesContent":["import type { NextApiRequest, NextApiResponse } from 'next';\nimport { FronteggProxy } from './FronteggProxy';\nimport { fronteggSSOPathRewrite, fronteggPathRewrite, defaultFronteggHeaders } from './constants';\nimport { isInternalRequest, rewritePath } from './helpers';\nimport { getSession } from '../pages';\nimport { CorsOptions, FronteggApiMiddlewareType } from './types';\n\nconst middlewarePromise = (req: NextApiRequest, res: NextApiResponse) =>\n new Promise<void>(async (resolve) => {\n const fronteggUrlPath = rewritePath(req.url ?? '/', fronteggPathRewrite);\n const rewriteUrl = rewritePath(fronteggUrlPath ?? '/', fronteggSSOPathRewrite);\n req.url = rewriteUrl;\n res.on('close', () => resolve());\n const options = {\n target: process.env['FRONTEGG_BASE_URL'],\n };\n if (process.env['FRONTEGG_TEST_URL'] && req.url == '/frontegg/middleware-test') {\n options.target = process.env['FRONTEGG_TEST_URL'];\n }\n\n const headers: Record<string, string> = {};\n if (process.env['FRONTEGG_SECURE_JWT_ENABLED'] === 'true') {\n const session = await getSession(req);\n if (session?.accessToken) {\n headers['authorization'] = 'Bearer ' + session.accessToken;\n }\n }\n FronteggProxy.web(req, res, {\n ...options,\n headers,\n });\n });\n\n/**\n * Next.js HTTP Proxy Middleware\n * @see https://nextjs.org/docs/api-routes/api-middlewares\n * @param {NextApiRequest} req - NextJS api request passed from api routing\n * @param {NextApiResponse} res - NextJS api response passed from api routing\n */\nconst FronteggApiMiddleware: FronteggApiMiddlewareType = (async (\n req: NextApiRequest,\n res: NextApiResponse\n): Promise<void> => {\n return await middlewarePromise(req, res);\n}) as FronteggApiMiddlewareType;\n\nFronteggApiMiddleware.cors =\n (options: CorsOptions) =>\n async (req: NextApiRequest, res: NextApiResponse): Promise<void> => {\n const {\n allowedOrigins = ['*'],\n allowedMethods = ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'OPTIONS'],\n allowedHeaders = ['Content-Type', 'Authorization'],\n allowCredentials = true,\n } = options;\n\n if (isInternalRequest(req.headers.host ?? '')) {\n const origin = req.headers.origin ?? '';\n const combinedHeaders = Array.from(new Set([...defaultFronteggHeaders, ...allowedHeaders]));\n\n if (allowedOrigins.includes(origin)) {\n res.setHeader('Access-Control-Allow-Origin', origin);\n } else {\n res.removeHeader('Access-Control-Allow-Origin');\n }\n\n res.setHeader('Access-Control-Allow-Methods', allowedMethods.join(','));\n res.setHeader('Access-Control-Allow-Headers', combinedHeaders.join(','));\n res.setHeader('Access-Control-Allow-Credentials', allowCredentials ? 'true' : 'false');\n }\n\n return middlewarePromise(req, res);\n };\n\nexport { FronteggApiMiddleware };\n"],"mappings":";;;;;;;;AACA,IAAAA,cAAA,GAAAC,OAAA;AACA,IAAAC,UAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,MAAA,GAAAH,OAAA;AAGA,MAAMI,iBAAiB,GAAGA,CAACC,GAAmB,EAAEC,GAAoB,KAClE,IAAIC,OAAO,CAAO,MAAOC,OAAO,IAAK;EAAA,IAAAC,QAAA;EACnC,MAAMC,eAAe,GAAG,IAAAC,oBAAW,GAAAF,QAAA,GAACJ,GAAG,CAACO,GAAG,YAAAH,QAAA,GAAI,GAAG,EAAEI,8BAAmB,CAAC;EACxE,MAAMC,UAAU,GAAG,IAAAH,oBAAW,EAACD,eAAe,WAAfA,eAAe,GAAI,GAAG,EAAEK,iCAAsB,CAAC;EAC9EV,GAAG,CAACO,GAAG,GAAGE,UAAU;EACpBR,GAAG,CAACU,EAAE,CAAC,OAAO,EAAE,MAAMR,OAAO,CAAC,CAAC,CAAC;EAChC,MAAMS,OAAO,GAAG;IACdC,MAAM,EAAEC,OAAO,CAACC,GAAG,CAAC,mBAAmB;EACzC,CAAC;EACD,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AAG,CAACgB,OAAO,CAACiB,IAAI,YAAAN,iBAAA,GAAI,EAAE,CAAC,EAAE;IAAA,IAAAO,mBAAA;IAC7C,MAAMC,MAAM,IAAAD,mBAAA,GAAGlC,GAAG,CAACgB,OAAO,CAACmB,MAAM,YAAAD,mBAAA,GAAI,EAAE;IACvC,MAAME,eAAe,GAAGC,KAAK,CAACC,IAAI,CAAC,IAAIC,GAAG,CAAC,CAAC,GAAGC,iCAAsB,EAAE,GAAGV,cAAc,CAAC,CAAC,CAAC;IAE3F,IAAIF,cAAc,CAACa,QAAQ,CAACN,MAAM,CAAC,EAAE;MACnClC,GAAG,CAACyC,SAAS,CAAC,6BAA6B,EAAEP,MAAM,CAAC;IACtD,CAAC,MAAM;MACLlC,GAAG,CAAC0C,YAAY,CAAC,6BAA6B,CAAC;IACjD;IAEA1C,GAAG,CAACyC,SAAS,CAAC,8BAA8B,EAAEb,cAAc,CAACe,IAAI,CAAC,GAAG,CAAC,CAAC;IACvE3C,GAAG,CAACyC,SAAS,CAAC,8BAA8B,EAAEN,eAAe,CAACQ,IAAI,CAAC,GAAG,CAAC,CAAC;IACxE3C,GAAG,CAACyC,SAAS,CAAC,kCAAkC,EAAEX,gBAAgB,GAAG,MAAM,GAAG,OAAO,CAAC;EACxF;EAEA,OAAOhC,iBAAiB,CAACC,GAAG,EAAEC,GAAG,CAAC;AACpC,CAAC","ignoreList":[]}
@@ -6,3 +6,4 @@ export declare const fronteggSSOPathRewrite: {
6
6
  patternStr: string;
7
7
  replaceStr: string;
8
8
  }[];
9
+ export declare const defaultFronteggHeaders: string[];
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.fronteggSSOPathRewrite = exports.fronteggPathRewrite = void 0;
6
+ exports.fronteggSSOPathRewrite = exports.fronteggPathRewrite = exports.defaultFronteggHeaders = void 0;
7
7
  const fronteggPathRewrite = exports.fronteggPathRewrite = [{
8
8
  patternStr: '^/api/',
9
9
  replaceStr: '/'
@@ -12,4 +12,5 @@ const fronteggSSOPathRewrite = exports.fronteggSSOPathRewrite = [{
12
12
  patternStr: '/frontegg/saml/callback$',
13
13
  replaceStr: '/auth/saml/callback'
14
14
  }];
15
+ const defaultFronteggHeaders = exports.defaultFronteggHeaders = ['Content-Type', 'Authorization', 'x-frontegg-framework', 'x-frontegg-sdk', 'frontegg-source', 'frontegg-requested-application-id'];
15
16
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","names":["fronteggPathRewrite","exports","patternStr","replaceStr","fronteggSSOPathRewrite"],"sources":["../../../../packages/nextjs/src/middleware/constants.ts"],"sourcesContent":["export const fronteggPathRewrite = [\n {\n patternStr: '^/api/',\n replaceStr: '/',\n },\n];\nexport const fronteggSSOPathRewrite = [\n {\n patternStr: '/frontegg/saml/callback$',\n replaceStr: '/auth/saml/callback',\n },\n];\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CACjC;EACEE,UAAU,EAAE,QAAQ;EACpBC,UAAU,EAAE;AACd,CAAC,CACF;AACM,MAAMC,sBAAsB,GAAAH,OAAA,CAAAG,sBAAA,GAAG,CACpC;EACEF,UAAU,EAAE,0BAA0B;EACtCC,UAAU,EAAE;AACd,CAAC,CACF","ignoreList":[]}
1
+ {"version":3,"file":"constants.js","names":["fronteggPathRewrite","exports","patternStr","replaceStr","fronteggSSOPathRewrite","defaultFronteggHeaders"],"sources":["../../../../packages/nextjs/src/middleware/constants.ts"],"sourcesContent":["export const fronteggPathRewrite = [\n {\n patternStr: '^/api/',\n replaceStr: '/',\n },\n];\nexport const fronteggSSOPathRewrite = [\n {\n patternStr: '/frontegg/saml/callback$',\n replaceStr: '/auth/saml/callback',\n },\n];\n\nexport const defaultFronteggHeaders = [\n 'Content-Type',\n 'Authorization',\n 'x-frontegg-framework',\n 'x-frontegg-sdk',\n 'frontegg-source',\n 'frontegg-requested-application-id',\n];\n"],"mappings":";;;;;;AAAO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAAG,CACjC;EACEE,UAAU,EAAE,QAAQ;EACpBC,UAAU,EAAE;AACd,CAAC,CACF;AACM,MAAMC,sBAAsB,GAAAH,OAAA,CAAAG,sBAAA,GAAG,CACpC;EACEF,UAAU,EAAE,0BAA0B;EACtCC,UAAU,EAAE;AACd,CAAC,CACF;AAEM,MAAME,sBAAsB,GAAAJ,OAAA,CAAAI,sBAAA,GAAG,CACpC,cAAc,EACd,eAAe,EACf,sBAAsB,EACtB,gBAAgB,EAChB,iBAAiB,EACjB,mCAAmC,CACpC","ignoreList":[]}
@@ -40,3 +40,4 @@ export declare const extractAccessToken: (bodyStr: string) => Tokens;
40
40
  * @param body
41
41
  */
42
42
  export declare const removeJwtSignatureFrom: <T extends unknown>(body: any) => T;
43
+ export declare const isInternalRequest: (host: string) => boolean;
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.rewritePath = exports.removeJwtSignatureFrom = exports.isFronteggOauthLogoutUrl = exports.isFronteggLogoutUrl = exports.getHostedLogoutUrl = exports.extractAccessToken = void 0;
7
+ exports.rewritePath = exports.removeJwtSignatureFrom = exports.isInternalRequest = exports.isFronteggOauthLogoutUrl = exports.isFronteggLogoutUrl = exports.getHostedLogoutUrl = exports.extractAccessToken = void 0;
8
8
  var _urls = require("../api/urls");
9
9
  var _config = _interopRequireDefault(require("../config"));
10
10
  var _routing = require("../utils/routing");
@@ -120,4 +120,6 @@ const removeJwtSignatureFrom = body => {
120
120
  return body;
121
121
  };
122
122
  exports.removeJwtSignatureFrom = removeJwtSignatureFrom;
123
+ const isInternalRequest = host => _config.default.appUrl.includes(host);
124
+ exports.isInternalRequest = isInternalRequest;
123
125
  //# sourceMappingURL=helpers.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.js","names":["_urls","require","_config","_interopRequireDefault","_routing","rewritePath","url","pathRewrite","Array","isArray","item","patternStr","replaceStr","pattern","RegExp","test","replace","path","exports","isFronteggLogoutUrl","endsWith","isFronteggOauthLogoutUrl","getHostedLogoutUrl","referer","config","appUrl","_config$authRoutes$lo","_config$authRoutes","logoutPath","authRoutes","logoutUrl","defaultFronteggRoutes","refererUrl","URL","isLogoutRoute","toString","includes","redirectUrl","origin","search","buildLogoutRoute","baseUrl","extractAccessToken","bodyStr","body","JSON","parse","authResponse","Object","assign","accessToken","access_token","refreshToken","refresh_token","jwtKeys","refreshTokenKeys","removeJwtSignatureFrom","forEach","key","split"],"sources":["../../../../packages/nextjs/src/middleware/helpers.ts"],"sourcesContent":["import { BuildRouteResult, buildLogoutRoute } from '../api/urls';\nimport config from '../config';\nimport { defaultFronteggRoutes } from '../utils/routing';\n\n/**\n * If pattern information matching the input url information is found in the `pathRewrite` array,\n * the url value is partially replaced with the `pathRewrite.replaceStr` value.\n * @param url\n * @param pathRewrite\n */\nexport const rewritePath = (\n url: string,\n pathRewrite: { [key: string]: string } | { patternStr: string; replaceStr: string }[]\n) => {\n if (Array.isArray(pathRewrite)) {\n for (const item of pathRewrite) {\n const { patternStr, replaceStr } = item;\n const pattern = RegExp(patternStr);\n if (pattern.test(url as string)) {\n return url.replace(pattern, replaceStr);\n }\n }\n } else {\n for (const patternStr in pathRewrite) {\n const pattern = RegExp(patternStr);\n const path = pathRewrite[patternStr];\n if (pattern.test(url as string)) {\n return url.replace(pattern, path);\n }\n }\n }\n return url;\n};\n\n/**\n * Checks If route is a logout route\n * @param url\n */\nexport const isFronteggLogoutUrl = (url: string) => url.endsWith('/logout');\n\n/**\n * Checks If route is a hosted logout route\n * @param url\n */\nexport const isFronteggOauthLogoutUrl = (url: string) => url.endsWith('/oauth/logout');\n\n/**\n * Returns url to be redirected for hosted logout\n * @param referer the route to redirect to after logout\n */\nexport const getHostedLogoutUrl = (referer = config.appUrl): BuildRouteResult => {\n const logoutPath = config.authRoutes?.logoutUrl ?? defaultFronteggRoutes.logoutUrl;\n const refererUrl = new URL(referer);\n const isLogoutRoute = refererUrl.toString().includes(logoutPath);\n\n const redirectUrl = isLogoutRoute ? refererUrl.origin + refererUrl.search : refererUrl.toString();\n\n return buildLogoutRoute(redirectUrl, config.baseUrl);\n};\n\nexport type Tokens = {\n accessToken: string;\n refreshToken: string;\n};\n\n/**\n * Extracts the access token from the response body\n * @param bodyStr\n */\nexport const extractAccessToken = (bodyStr: string): Tokens => {\n const body = JSON.parse(bodyStr);\n\n if (body.authResponse) {\n Object.assign(body, body.authResponse);\n }\n return {\n accessToken: body.accessToken || body.access_token,\n refreshToken: body.refreshToken || body.refresh_token,\n };\n};\n\nconst jwtKeys = ['accessToken', 'access_token', 'idToken', 'id_token'];\nconst refreshTokenKeys = ['refreshToken', 'refresh_token'];\n/**\n * Removes the signature from the JWT token\n * @param body\n */\nexport const removeJwtSignatureFrom = <T extends any>(body: any): T => {\n if (!body) {\n return body;\n }\n\n if (body.authResponse) {\n jwtKeys.forEach((key) => {\n if (body.authResponse[key]) {\n // body.authResponse[key] = \"REDACTED_FOR_SECURITY\";\n // body.authResponse[key] = body.authResponse[key].split('.')[0] + '.' + body.authResponse[key].split('.')[1];\n body.authResponse[key] = `REDACTED_FOR_SECURITY.${body.authResponse[key].split('.')[1]}.REDACTED_FOR_SECURITY`;\n }\n });\n refreshTokenKeys.forEach((key) => {\n if (body.authResponse[key]) {\n delete body.authResponse[key];\n }\n });\n }\n\n jwtKeys.forEach((key) => {\n if (body[key]) {\n // body[key] = \"REDACTED_FOR_SECURITY\";\n // body[key] = body[key].split('.')[0] + '.' + body[key].split('.')[1];\n body[key] = `REDACTED_FOR_SECURITY.${body[key].split('.')[1]}.REDACTED_FOR_SECURITY`;\n }\n });\n refreshTokenKeys.forEach((key) => {\n if (body[key]) {\n delete body[key];\n }\n });\n return body;\n};\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GA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A,IAAI,EAAE;IACT,OAAOA,IAAI;EACb;EAEA,IAAIA,IAAI,CAACG,YAAY,EAAE;IACrBO,OAAO,CAACG,OAAO,CAAEC,GAAG,IAAK;MACvB,IAAId,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,EAAE;QAC1B;QACA;QACAd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,GAAG,yBAAyBd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;MAChH;IACF,CAAC,CAAC;IACFJ,gBAAgB,CAACE,OAAO,CAAEC,GAAG,IAAK;MAChC,IAAId,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,EAAE;QAC1B,OAAOd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC;MAC/B;IACF,CAAC,CAAC;EACJ;EAEAJ,OAAO,CAACG,OAAO,CAAEC,GAAG,IAAK;IACvB,IAAId,IAAI,CAACc,GAAG,CAAC,EAAE;MACb;MACA;MACAd,IAAI,CAACc,GAAG,CAAC,GAAG,yBAAyBd,IAAI,CAACc,GAAG,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;IACtF;EACF,CAAC,CAAC;EACFJ,gBAAgB,CAACE,OAAO,CAAEC,GAAG,IAAK;IAChC,IAAId,IAAI,CAACc,GAAG,CAAC,EAAE;MACb,OAAOd,IAAI,CAACc,GAAG,CAAC;IAClB;EACF,CAAC,CAAC;EACF,OAAOd,IAAI;AACb,CAAC;AAAC1B,OAAA,CAAAsC,sBAAA,GAAAA,sBAAA","ignoreList":[]}
1
+ {"version":3,"file":"helpers.js","names":["_urls","require","_config","_interopRequireDefault","_routing","rewritePath","url","pathRewrite","Array","isArray","item","patternStr","replaceStr","pattern","RegExp","test","replace","path","exports","isFronteggLogoutUrl","endsWith","isFronteggOauthLogoutUrl","getHostedLogoutUrl","referer","config","appUrl","_config$authRoutes$lo","_config$authRoutes","logoutPath","authRoutes","logoutUrl","defaultFronteggRoutes","refererUrl","URL","isLogoutRoute","toString","includes","redirectUrl","origin","search","buildLogoutRoute","baseUrl","extractAccessToken","bodyStr","body","JSON","parse","authResponse","Object","assign","accessToken","access_token","refreshToken","refresh_token","jwtKeys","refreshTokenKeys","removeJwtSignatureFrom","forEach","key","split","isInternalRequest","host"],"sources":["../../../../packages/nextjs/src/middleware/helpers.ts"],"sourcesContent":["import { BuildRouteResult, buildLogoutRoute } from '../api/urls';\nimport config from '../config';\nimport { defaultFronteggRoutes } from '../utils/routing';\n\n/**\n * If pattern information matching the input url information is found in the `pathRewrite` array,\n * the url value is partially replaced with the `pathRewrite.replaceStr` value.\n * @param url\n * @param pathRewrite\n */\nexport const rewritePath = (\n url: string,\n pathRewrite: { [key: string]: string } | { patternStr: string; replaceStr: string }[]\n) => {\n if (Array.isArray(pathRewrite)) {\n for (const item of pathRewrite) {\n const { patternStr, replaceStr } = item;\n const pattern = RegExp(patternStr);\n if (pattern.test(url as string)) {\n return url.replace(pattern, replaceStr);\n }\n }\n } else {\n for (const patternStr in pathRewrite) {\n const pattern = RegExp(patternStr);\n const path = pathRewrite[patternStr];\n if (pattern.test(url as string)) {\n return url.replace(pattern, path);\n }\n }\n }\n return url;\n};\n\n/**\n * Checks If route is a logout route\n * @param url\n */\nexport const isFronteggLogoutUrl = (url: string) => url.endsWith('/logout');\n\n/**\n * Checks If route is a hosted logout route\n * @param url\n */\nexport const isFronteggOauthLogoutUrl = (url: string) => url.endsWith('/oauth/logout');\n\n/**\n * Returns url to be redirected for hosted logout\n * @param referer the route to redirect to after logout\n */\nexport const getHostedLogoutUrl = (referer = config.appUrl): BuildRouteResult => {\n const logoutPath = config.authRoutes?.logoutUrl ?? defaultFronteggRoutes.logoutUrl;\n const refererUrl = new URL(referer);\n const isLogoutRoute = refererUrl.toString().includes(logoutPath);\n\n const redirectUrl = isLogoutRoute ? refererUrl.origin + refererUrl.search : refererUrl.toString();\n\n return buildLogoutRoute(redirectUrl, config.baseUrl);\n};\n\nexport type Tokens = {\n accessToken: string;\n refreshToken: string;\n};\n\n/**\n * Extracts the access token from the response body\n * @param bodyStr\n */\nexport const extractAccessToken = (bodyStr: string): Tokens => {\n const body = JSON.parse(bodyStr);\n\n if (body.authResponse) {\n Object.assign(body, body.authResponse);\n }\n return {\n accessToken: body.accessToken || body.access_token,\n refreshToken: body.refreshToken || body.refresh_token,\n };\n};\n\nconst jwtKeys = ['accessToken', 'access_token', 'idToken', 'id_token'];\nconst refreshTokenKeys = ['refreshToken', 'refresh_token'];\n/**\n * Removes the signature from the JWT token\n * @param body\n */\nexport const removeJwtSignatureFrom = <T extends any>(body: any): T => {\n if (!body) {\n return body;\n }\n\n if (body.authResponse) {\n jwtKeys.forEach((key) => {\n if (body.authResponse[key]) {\n // body.authResponse[key] = \"REDACTED_FOR_SECURITY\";\n // body.authResponse[key] = body.authResponse[key].split('.')[0] + '.' + body.authResponse[key].split('.')[1];\n body.authResponse[key] = `REDACTED_FOR_SECURITY.${body.authResponse[key].split('.')[1]}.REDACTED_FOR_SECURITY`;\n }\n });\n refreshTokenKeys.forEach((key) => {\n if (body.authResponse[key]) {\n delete body.authResponse[key];\n }\n });\n }\n\n jwtKeys.forEach((key) => {\n if (body[key]) {\n // body[key] = \"REDACTED_FOR_SECURITY\";\n // body[key] = body[key].split('.')[0] + '.' + body[key].split('.')[1];\n body[key] = `REDACTED_FOR_SECURITY.${body[key].split('.')[1]}.REDACTED_FOR_SECURITY`;\n }\n });\n refreshTokenKeys.forEach((key) => {\n if (body[key]) {\n delete body[key];\n }\n });\n return body;\n};\n\nexport const isInternalRequest = (host: string) => config.appUrl.includes(host);\n"],"mappings":";;;;;;;AAAA,IAAAA,KAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,QAAA,GAAAH,OAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,MAAMI,WAAW,GAAGA,CACzBC,GAAW,E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AAId,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,EAAE;QAC1B;QACA;QACAd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,GAAG,yBAAyBd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;MAChH;IACF,CAAC,CAAC;IACFJ,gBAAgB,CAACE,OAAO,CAAEC,GAAG,IAAK;MAChC,IAAId,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC,EAAE;QAC1B,OAAOd,IAAI,CAACG,YAAY,CAACW,GAAG,CAAC;MAC/B;IACF,CAAC,CAAC;EACJ;EAEAJ,OAAO,CAACG,OAAO,CAAEC,GAAG,IAAK;IACvB,IAAId,IAAI,CAACc,GAAG,CAAC,EAAE;MACb;MACA;MACAd,IAAI,CAACc,GAAG,CAAC,GAAG,yBAAyBd,IAAI,CAACc,GAAG,CAAC,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,wBAAwB;IACtF;EACF,CAAC,CAAC;EACFJ,gBAAgB,CAACE,OAAO,CAAEC,GAAG,IAAK;IAChC,IAAId,IAAI,CAACc,GAAG,CAAC,EAAE;MACb,OAAOd,IAAI,CAACc,GAAG,CAAC;IAClB;EACF,CAAC,CAAC;EACF,OAAOd,IAAI;AACb,CAAC;AAAC1B,OAAA,CAAAsC,sBAAA,GAAAA,sBAAA;AAEK,MAAMI,iBAAiB,GAAIC,IAAY,IAAKrC,eAAM,CAACC,MAAM,CAACW,QAAQ,CAACyB,IAAI,CAAC;AAAC3C,OAAA,CAAA0C,iBAAA,GAAAA,iBAAA","ignoreList":[]}
@@ -0,0 +1,10 @@
1
+ import type { NextApiRequest, NextApiResponse } from 'next';
2
+ export type CorsOptions = {
3
+ allowedOrigins?: string[];
4
+ allowedMethods?: string[];
5
+ allowedHeaders?: string[];
6
+ allowCredentials?: boolean;
7
+ };
8
+ export type FronteggApiMiddlewareType = ((req: NextApiRequest, res: NextApiResponse) => Promise<void>) & {
9
+ cors: (options: CorsOptions) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
10
+ };
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","names":[],"sources":["../../../../packages/nextjs/src/middleware/types.ts"],"sourcesContent":["import type { NextApiRequest, NextApiResponse } from 'next';\n\nexport type CorsOptions = {\n allowedOrigins?: string[];\n allowedMethods?: string[];\n allowedHeaders?: string[];\n allowCredentials?: boolean;\n};\n\nexport type FronteggApiMiddlewareType = ((req: NextApiRequest, res: NextApiResponse) => Promise<void>) & {\n cors: (options: CorsOptions) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;\n};\n"],"mappings":"","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@frontegg/nextjs",
3
3
  "libName": "FronteggNextJs",
4
- "version": "9.1.2-alpha.12010090267",
4
+ "version": "9.2.1-alpha.12031586201",
5
5
  "author": "Frontegg LTD",
6
6
  "license": "MIT",
7
7
  "repository": {
package/sdkVersion.js CHANGED
@@ -5,6 +5,6 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.default = void 0;
7
7
  var _default = exports.default = {
8
- version: '9.1.2-alpha.12010090267'
8
+ version: '9.2.1-alpha.12031586201'
9
9
  };
10
10
  //# sourceMappingURL=sdkVersion.js.map
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.1.2-alpha.12010090267' };\n"],"mappings":";;;;;;iCAAe;EAAEA,OAAO,EAAE;AAA0B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"sdkVersion.js","names":["version"],"sources":["../../../packages/nextjs/src/sdkVersion.ts"],"sourcesContent":["export default { version: '9.2.1-alpha.12031586201' };\n"],"mappings":";;;;;;iCAAe;EAAEA,OAAO,EAAE;AAA0B,CAAC","ignoreList":[]}