@aws-amplify/adapter-nextjs 1.6.7-unstable.e5a8569.0 → 1.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/api/generateServerClient.js.map +1 -1
- package/dist/cjs/api/index.js.map +1 -1
- package/dist/cjs/auth/createAuthRouteHandlersFactory.js.map +1 -1
- package/dist/cjs/auth/handleAuthApiRouteRequestForAppRouter.js.map +1 -1
- package/dist/cjs/auth/handleAuthApiRouteRequestForPagesRouter.js.map +1 -1
- package/dist/cjs/auth/handlers/handleSignInCallbackRequest.js.map +1 -1
- package/dist/cjs/auth/handlers/handleSignInCallbackRequestForPagesRouter.js.map +1 -1
- package/dist/cjs/auth/handlers/handleSignOutCallbackRequest.js.map +1 -1
- package/dist/cjs/auth/handlers/handleSignOutCallbackRequestForPagesRouter.js.map +1 -1
- package/dist/cjs/auth/handlers/index.js.map +1 -1
- package/dist/cjs/auth/index.js.map +1 -1
- package/dist/cjs/auth/utils/appendSetCookieHeaders.js.map +1 -1
- package/dist/cjs/auth/utils/appendSetCookieHeadersToNextApiResponse.js.map +1 -1
- package/dist/cjs/auth/utils/createErrorSearchParamsString.js.map +1 -1
- package/dist/cjs/auth/utils/createUrlSearchParams.js.map +1 -1
- package/dist/cjs/auth/utils/getCookieValuesFromNextApiRequest.js.map +1 -1
- package/dist/cjs/auth/utils/getCookieValuesFromRequest.js.map +1 -1
- package/dist/cjs/auth/utils/getSearchParamValueFromUrl.js.map +1 -1
- package/dist/cjs/auth/utils/hasActiveUserSession.js.map +1 -1
- package/dist/cjs/auth/utils/index.js.map +1 -1
- package/dist/cjs/auth/utils/origin.js.map +1 -1
- package/dist/cjs/auth/utils/predicates.js +16 -1
- package/dist/cjs/auth/utils/predicates.js.map +1 -1
- package/dist/cjs/auth/utils/resolveIdentityProviderFromUrl.js.map +1 -1
- package/dist/cjs/auth/utils/resolveRedirectUrl.js.map +1 -1
- package/dist/cjs/auth/utils/tokenCookies.js.map +1 -1
- package/dist/cjs/createServerRunner.js.map +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/utils/cookie/index.js.map +1 -1
- package/dist/cjs/utils/cookie/serializeCookie.js.map +1 -1
- package/dist/cjs/utils/createCookieStorageAdapterFromNextServerContext.js.map +1 -1
- package/dist/cjs/utils/createRunWithAmplifyServerContext.js.map +1 -1
- package/dist/cjs/utils/createTokenValidator.js.map +1 -1
- package/dist/cjs/utils/globalSettings.js.map +1 -1
- package/dist/cjs/utils/index.js.map +1 -1
- package/dist/cjs/utils/isValidCognitoToken.js.map +1 -1
- package/dist/esm/api/generateServerClient.mjs.map +1 -1
- package/dist/esm/auth/createAuthRouteHandlersFactory.mjs.map +1 -1
- package/dist/esm/auth/handleAuthApiRouteRequestForAppRouter.mjs.map +1 -1
- package/dist/esm/auth/handleAuthApiRouteRequestForPagesRouter.mjs.map +1 -1
- package/dist/esm/auth/handlers/handleSignInCallbackRequest.mjs.map +1 -1
- package/dist/esm/auth/handlers/handleSignInCallbackRequestForPagesRouter.mjs.map +1 -1
- package/dist/esm/auth/handlers/handleSignOutCallbackRequest.mjs.map +1 -1
- package/dist/esm/auth/handlers/handleSignOutCallbackRequestForPagesRouter.mjs.map +1 -1
- package/dist/esm/auth/utils/appendSetCookieHeaders.mjs.map +1 -1
- package/dist/esm/auth/utils/appendSetCookieHeadersToNextApiResponse.mjs.map +1 -1
- package/dist/esm/auth/utils/createErrorSearchParamsString.mjs.map +1 -1
- package/dist/esm/auth/utils/createUrlSearchParams.mjs.map +1 -1
- package/dist/esm/auth/utils/getCookieValuesFromNextApiRequest.mjs.map +1 -1
- package/dist/esm/auth/utils/getCookieValuesFromRequest.mjs.map +1 -1
- package/dist/esm/auth/utils/getSearchParamValueFromUrl.mjs.map +1 -1
- package/dist/esm/auth/utils/hasActiveUserSession.mjs.map +1 -1
- package/dist/esm/auth/utils/origin.mjs.map +1 -1
- package/dist/esm/auth/utils/predicates.mjs +16 -1
- package/dist/esm/auth/utils/predicates.mjs.map +1 -1
- package/dist/esm/auth/utils/resolveIdentityProviderFromUrl.mjs.map +1 -1
- package/dist/esm/auth/utils/resolveRedirectUrl.mjs.map +1 -1
- package/dist/esm/auth/utils/tokenCookies.mjs.map +1 -1
- package/dist/esm/createServerRunner.mjs.map +1 -1
- package/dist/esm/utils/cookie/serializeCookie.mjs.map +1 -1
- package/dist/esm/utils/createCookieStorageAdapterFromNextServerContext.mjs.map +1 -1
- package/dist/esm/utils/createRunWithAmplifyServerContext.mjs.map +1 -1
- package/dist/esm/utils/createTokenValidator.mjs.map +1 -1
- package/dist/esm/utils/globalSettings.mjs.map +1 -1
- package/dist/esm/utils/isValidCognitoToken.mjs.map +1 -1
- package/package.json +70 -70
- package/src/auth/utils/predicates.ts +19 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateServerClient.js","sources":["../../../src/api/generateServerClient.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClientUsingCookies = generateServerClientUsingCookies;\nexports.generateServerClientUsingReqRes = generateServerClientUsingReqRes;\nconst internals_1 = require(\"aws-amplify/api/internals\");\nconst server_1 = require(\"aws-amplify/api/server\");\nconst internals_2 = require(\"aws-amplify/adapter-core/internals\");\nconst utils_1 = require(\"aws-amplify/utils\");\nconst createServerRunnerForAPI_1 = require(\"./createServerRunnerForAPI\");\n/**\n * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering\n *\n * @example\n * import { cookies } from \"next/headers\"\n *\n * const client = generateServerClientUsingCookies({ cookies });\n * const result = await client.graphql({ query: listPosts });\n */\nfunction generateServerClientUsingCookies(options) {\n if (typeof options.cookies !== 'function') {\n throw new internals_2.AmplifyServerContextError({\n message: 'generateServerClientUsingCookies is only compatible with the `cookies` Dynamic Function available in Server Components.',\n // TODO: link to docs\n recoverySuggestion: 'use `generateServerClient` inside of `runWithAmplifyServerContext` with the `request` object.',\n });\n }\n const { runWithAmplifyServerContext, resourcesConfig } = (0, createServerRunnerForAPI_1.createServerRunnerForAPI)({ config: options.config });\n // This function reference gets passed down to InternalGraphQLAPI.ts.graphql\n // where this._graphql is passed in as the `fn` argument\n // causing it to always get invoked inside `runWithAmplifyServerContext`\n const getAmplify = (fn) => runWithAmplifyServerContext({\n nextServerContext: { cookies: options.cookies },\n operation: contextSpec => fn((0, internals_2.getAmplifyServerContext)(contextSpec).amplify),\n });\n const { cookies: _cookies, config: _config, ...params } = options;\n return (0, internals_1.generateClientWithAmplifyInstance)({\n amplify: getAmplify,\n config: resourcesConfig,\n ...params,\n }); // TS can't narrow the type here.\n}\n/**\n * Generates an API client that can be used with both Pages Router and App Router\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClientUsingReqRes({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nfunction generateServerClientUsingReqRes(options) {\n const amplifyConfig = (0, utils_1.parseAmplifyConfig)(options.config);\n const { config: _config, ...params } = options;\n return (0, server_1.generateClient)({\n config: amplifyConfig,\n ...params,\n });\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;AAC3E,OAAO,CAAC,+BAA+B,GAAG,+BAA+B;AACzE,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAClD,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC5C,MAAM,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,CAAC,OAAO,EAAE;AACnD,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,KAAK,UAAU,EAAE;AAC/C,QAAQ,MAAM,IAAI,WAAW,CAAC,yBAAyB,CAAC;AACxD,YAAY,OAAO,EAAE,yHAAyH;AAC9I;AACA,YAAY,kBAAkB,EAAE,+FAA+F;AAC/H,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"generateServerClient.js","sources":["../../../src/api/generateServerClient.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClientUsingCookies = generateServerClientUsingCookies;\nexports.generateServerClientUsingReqRes = generateServerClientUsingReqRes;\nconst internals_1 = require(\"aws-amplify/api/internals\");\nconst server_1 = require(\"aws-amplify/api/server\");\nconst internals_2 = require(\"aws-amplify/adapter-core/internals\");\nconst utils_1 = require(\"aws-amplify/utils\");\nconst createServerRunnerForAPI_1 = require(\"./createServerRunnerForAPI\");\n/**\n * Generates an API client that can be used inside a Next.js Server Component with Dynamic Rendering\n *\n * @example\n * import { cookies } from \"next/headers\"\n *\n * const client = generateServerClientUsingCookies({ cookies });\n * const result = await client.graphql({ query: listPosts });\n */\nfunction generateServerClientUsingCookies(options) {\n if (typeof options.cookies !== 'function') {\n throw new internals_2.AmplifyServerContextError({\n message: 'generateServerClientUsingCookies is only compatible with the `cookies` Dynamic Function available in Server Components.',\n // TODO: link to docs\n recoverySuggestion: 'use `generateServerClient` inside of `runWithAmplifyServerContext` with the `request` object.',\n });\n }\n const { runWithAmplifyServerContext, resourcesConfig } = (0, createServerRunnerForAPI_1.createServerRunnerForAPI)({ config: options.config });\n // This function reference gets passed down to InternalGraphQLAPI.ts.graphql\n // where this._graphql is passed in as the `fn` argument\n // causing it to always get invoked inside `runWithAmplifyServerContext`\n const getAmplify = (fn) => runWithAmplifyServerContext({\n nextServerContext: { cookies: options.cookies },\n operation: contextSpec => fn((0, internals_2.getAmplifyServerContext)(contextSpec).amplify),\n });\n const { cookies: _cookies, config: _config, ...params } = options;\n return (0, internals_1.generateClientWithAmplifyInstance)({\n amplify: getAmplify,\n config: resourcesConfig,\n ...params,\n }); // TS can't narrow the type here.\n}\n/**\n * Generates an API client that can be used with both Pages Router and App Router\n *\n * @example\n * import config from './amplifyconfiguration.json';\n * import { listPosts } from './graphql/queries';\n *\n * const client = generateServerClientUsingReqRes({ config });\n *\n * const result = await runWithAmplifyServerContext({\n * nextServerContext: { request, response },\n * operation: (contextSpec) => client.graphql(contextSpec, {\n * query: listPosts,\n * }),\n * });\n */\nfunction generateServerClientUsingReqRes(options) {\n const amplifyConfig = (0, utils_1.parseAmplifyConfig)(options.config);\n const { config: _config, ...params } = options;\n return (0, server_1.generateClient)({\n config: amplifyConfig,\n ...params,\n });\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gCAAgC,GAAG,gCAAgC;AAC3E,OAAO,CAAC,+BAA+B,GAAG,+BAA+B;AACzE,MAAM,WAAW,GAAG,OAAO,CAAC,2BAA2B,CAAC;AACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAClD,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,OAAO,GAAG,OAAO,CAAC,mBAAmB,CAAC;AAC5C,MAAM,0BAA0B,GAAG,OAAO,CAAC,4BAA4B,CAAC;AACxE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,gCAAgC,CAAC,OAAO,EAAE;AACnD,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,KA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AAQ,GAAG,MAAM;AACjB,KAAK,CAAC;AACN;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/api/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClientUsingCookies = exports.generateServerClientUsingReqRes = void 0;\nvar generateServerClient_1 = require(\"./generateServerClient\");\nObject.defineProperty(exports, \"generateServerClientUsingReqRes\", { enumerable: true, get: function () { return generateServerClient_1.generateServerClientUsingReqRes; } });\nObject.defineProperty(exports, \"generateServerClientUsingCookies\", { enumerable: true, get: function () { return generateServerClient_1.generateServerClientUsingCookies; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gCAAgC,GAAG,OAAO,CAAC,+BAA+B,GAAG,MAAM;AAC3F,IAAI,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAC9D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iCAAiC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,+BAA+B,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/api/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.generateServerClientUsingCookies = exports.generateServerClientUsingReqRes = void 0;\nvar generateServerClient_1 = require(\"./generateServerClient\");\nObject.defineProperty(exports, \"generateServerClientUsingReqRes\", { enumerable: true, get: function () { return generateServerClient_1.generateServerClientUsingReqRes; } });\nObject.defineProperty(exports, \"generateServerClientUsingCookies\", { enumerable: true, get: function () { return generateServerClient_1.generateServerClientUsingCookies; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,gCAAgC,GAAG,OAAO,CAAC,+BAA+B,GAAG,MAAM;AAC3F,IAAI,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAC9D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iCAAiC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC;AAC5K,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,kCAAkC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,gCAAgC,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAuthRouteHandlersFactory.js","sources":["../../../src/auth/createAuthRouteHandlersFactory.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createAuthRouteHandlersFactory = void 0;\nconst internals_1 = require(\"aws-amplify/adapter-core/internals\");\nconst utils_1 = require(\"./utils\");\nconst handleAuthApiRouteRequestForAppRouter_1 = require(\"./handleAuthApiRouteRequestForAppRouter\");\nconst handleAuthApiRouteRequestForPagesRouter_1 = require(\"./handleAuthApiRouteRequestForPagesRouter\");\nconst createAuthRouteHandlersFactory = ({ config: resourcesConfig, amplifyAppOrigin, runWithAmplifyServerContext, globalSettings, }) => {\n const handleRequest = async ({ request, contextOrResponse, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n if ((0, utils_1.isNextApiRequest)(request) && (0, utils_1.isNextApiResponse)(contextOrResponse)) {\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handleAuthApiRouteRequestForPagesRouter_1.handleAuthApiRouteRequestForPagesRouter)({\n request,\n response: contextOrResponse,\n handlerInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin,\n runWithAmplifyServerContext,\n });\n // In the Pages Router, the final response is handled by contextOrResponse\n return;\n }\n if ((0, utils_1.isNextRequest)(request) &&\n (0, utils_1.isAuthRoutesHandlersContext)(contextOrResponse)) {\n // In the App Router, the final response is constructed and returned\n return (0, handleAuthApiRouteRequestForAppRouter_1.handleAuthApiRouteRequestForAppRouter)({\n request,\n handlerContext: contextOrResponse,\n handlerInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin,\n runWithAmplifyServerContext,\n });\n }\n // this should not be happening\n throw new Error('Invalid request and context/response combination. The request cannot be handled.');\n };\n return (createAuthRoutesHandlersInput = {}) => {\n // origin validation should happen when createAuthRouteHandlers is being called to create\n // Auth API routes.\n if (!amplifyAppOrigin) {\n throw new internals_1.AmplifyServerContextError({\n message: 'Could not find the AMPLIFY_APP_ORIGIN environment variable.',\n recoverySuggestion: 'Add the AMPLIFY_APP_ORIGIN environment variable to the `.env` file of your Next.js project.',\n });\n }\n if (!(0, utils_1.isValidOrigin)(amplifyAppOrigin)) {\n throw new internals_1.AmplifyServerContextError({\n message: 'AMPLIFY_APP_ORIGIN environment variable contains an invalid origin string.',\n recoverySuggestion: 'Ensure the AMPLIFY_APP_ORIGIN environment variable is a valid origin string.',\n });\n }\n // OAuth config validation should happen when createAuthRouteHandlers is being called to create\n // Auth API routes.\n (0, internals_1.assertTokenProviderConfig)(resourcesConfig.Auth?.Cognito);\n (0, internals_1.assertOAuthConfig)(resourcesConfig.Auth.Cognito);\n const { userPoolClientId } = resourcesConfig.Auth.Cognito;\n const { oauth: oAuthConfig } = resourcesConfig.Auth.Cognito.loginWith;\n const setCookieOptions = globalSettings.getRuntimeOptions().cookies ?? {};\n // The call-site of this returned function is the Next.js API route file\n return (request, contextOrResponse) => handleRequest({\n request,\n contextOrResponse,\n handlerInput: createAuthRoutesHandlersInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin: amplifyAppOrigin,\n });\n };\n};\nexports.createAuthRouteHandlersFactory = createAuthRouteHandlersFactory;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,8BAA8B,GAAG,MAAM;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,uCAAuC,GAAG,OAAO,CAAC,yCAAyC,CAAC;AAClG,MAAM,yCAAyC,GAAG,OAAO,CAAC,2CAA2C,CAAC;AACtG,MAAM,8BAA8B,GAAG,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,gBAAgB,EAAE,2BAA2B,EAAE,cAAc,GAAG,KAAK;AACxI,IAAI,MAAM,aAAa,GAAG,OAAO,EAAE,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AAC5I,QAAQ,IAAI,IAAI,OAAO,CAAC,gBAAgB,EAAE,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,EAAE;AACzG;AACA;AACA;AACA;AACA,YAAY,MAAM,IAAI,yCAAyC,CAAC,uCAAuC,EAAE;AACzG,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ,EAAE,iBAAiB;AAC3C,gBAAgB,YAAY;AAC5B,gBAAgB,gBAAgB;AAChC,gBAAgB,WAAW;AAC3B,gBAAgB,gBAAgB;AAChC,gBAAgB,MAAM;AACtB,gBAAgB,2BAA2B;AAC3C,aAAa,CAAC;AACd;AACA,YAAY;AACZ;
|
|
1
|
+
{"version":3,"file":"createAuthRouteHandlersFactory.js","sources":["../../../src/auth/createAuthRouteHandlersFactory.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createAuthRouteHandlersFactory = void 0;\nconst internals_1 = require(\"aws-amplify/adapter-core/internals\");\nconst utils_1 = require(\"./utils\");\nconst handleAuthApiRouteRequestForAppRouter_1 = require(\"./handleAuthApiRouteRequestForAppRouter\");\nconst handleAuthApiRouteRequestForPagesRouter_1 = require(\"./handleAuthApiRouteRequestForPagesRouter\");\nconst createAuthRouteHandlersFactory = ({ config: resourcesConfig, amplifyAppOrigin, runWithAmplifyServerContext, globalSettings, }) => {\n const handleRequest = async ({ request, contextOrResponse, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n if ((0, utils_1.isNextApiRequest)(request) && (0, utils_1.isNextApiResponse)(contextOrResponse)) {\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handleAuthApiRouteRequestForPagesRouter_1.handleAuthApiRouteRequestForPagesRouter)({\n request,\n response: contextOrResponse,\n handlerInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin,\n runWithAmplifyServerContext,\n });\n // In the Pages Router, the final response is handled by contextOrResponse\n return;\n }\n if ((0, utils_1.isNextRequest)(request) &&\n (0, utils_1.isAuthRoutesHandlersContext)(contextOrResponse)) {\n // In the App Router, the final response is constructed and returned\n return (0, handleAuthApiRouteRequestForAppRouter_1.handleAuthApiRouteRequestForAppRouter)({\n request,\n handlerContext: contextOrResponse,\n handlerInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin,\n runWithAmplifyServerContext,\n });\n }\n // this should not be happening\n throw new Error('Invalid request and context/response combination. The request cannot be handled.');\n };\n return (createAuthRoutesHandlersInput = {}) => {\n // origin validation should happen when createAuthRouteHandlers is being called to create\n // Auth API routes.\n if (!amplifyAppOrigin) {\n throw new internals_1.AmplifyServerContextError({\n message: 'Could not find the AMPLIFY_APP_ORIGIN environment variable.',\n recoverySuggestion: 'Add the AMPLIFY_APP_ORIGIN environment variable to the `.env` file of your Next.js project.',\n });\n }\n if (!(0, utils_1.isValidOrigin)(amplifyAppOrigin)) {\n throw new internals_1.AmplifyServerContextError({\n message: 'AMPLIFY_APP_ORIGIN environment variable contains an invalid origin string.',\n recoverySuggestion: 'Ensure the AMPLIFY_APP_ORIGIN environment variable is a valid origin string.',\n });\n }\n // OAuth config validation should happen when createAuthRouteHandlers is being called to create\n // Auth API routes.\n (0, internals_1.assertTokenProviderConfig)(resourcesConfig.Auth?.Cognito);\n (0, internals_1.assertOAuthConfig)(resourcesConfig.Auth.Cognito);\n const { userPoolClientId } = resourcesConfig.Auth.Cognito;\n const { oauth: oAuthConfig } = resourcesConfig.Auth.Cognito.loginWith;\n const setCookieOptions = globalSettings.getRuntimeOptions().cookies ?? {};\n // The call-site of this returned function is the Next.js API route file\n return (request, contextOrResponse) => handleRequest({\n request,\n contextOrResponse,\n handlerInput: createAuthRoutesHandlersInput,\n userPoolClientId,\n oAuthConfig,\n setCookieOptions,\n origin: amplifyAppOrigin,\n });\n };\n};\nexports.createAuthRouteHandlersFactory = createAuthRouteHandlersFactory;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,8BAA8B,GAAG,MAAM;AAC/C,MAAM,WAAW,GAAG,OAAO,CAAC,oCAAoC,CAAC;AACjE,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AA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,OAAO,CAAC,8BAA8B,GAAG,8BAA8B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleAuthApiRouteRequestForAppRouter.js","sources":["../../../src/auth/handleAuthApiRouteRequestForAppRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleAuthApiRouteRequestForAppRouter = void 0;\nconst utils_1 = require(\"./utils\");\nconst handlers_1 = require(\"./handlers\");\nconst handleAuthApiRouteRequestForAppRouter = async ({ request, handlerContext, handlerInput, userPoolClientId, oAuthConfig, origin, setCookieOptions, runWithAmplifyServerContext, }) => {\n if (request.method !== 'GET') {\n return new Response(null, { status: 405 });\n }\n const { slug } = await handlerContext.params;\n // don't support [...slug] here\n if (slug === undefined || Array.isArray(slug)) {\n return new Response(null, { status: 400 });\n }\n if (!(0, utils_1.isSupportedAuthApiRoutePath)(slug)) {\n return new Response(null, { status: 404 });\n }\n switch (slug) {\n case 'sign-up': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithAppRouter)({\n request,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }),\n });\n }\n return (0, handlers_1.handleSignInSignUpRequest)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n type: 'signUp',\n userPoolClientId,\n });\n }\n case 'sign-in': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithAppRouter)({\n request,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }),\n });\n }\n return (0, handlers_1.handleSignInSignUpRequest)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n type: 'signIn',\n userPoolClientId,\n });\n }\n case 'sign-out':\n return (0, handlers_1.handleSignOutRequest)({\n oAuthConfig,\n origin,\n setCookieOptions,\n userPoolClientId,\n });\n case 'sign-in-callback':\n return (0, handlers_1.handleSignInCallbackRequest)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n userPoolClientId,\n });\n case 'sign-out-callback':\n return (0, handlers_1.handleSignOutCallbackRequest)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n userPoolClientId,\n });\n // default:\n // is unreachable by the guard of isSupportedAuthApiRoutePath()\n }\n};\nexports.handleAuthApiRouteRequestForAppRouter = handleAuthApiRouteRequestForAppRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qCAAqC,GAAG,MAAM;AACtD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,qCAAqC,GAAG,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,2BAA2B,GAAG,KAAK;AAC1L,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;AAClC,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD;
|
|
1
|
+
{"version":3,"file":"handleAuthApiRouteRequestForAppRouter.js","sources":["../../../src/auth/handleAuthApiRouteRequestForAppRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleAuthApiRouteRequestForAppRouter = void 0;\nconst utils_1 = require(\"./utils\");\nconst handlers_1 = require(\"./handlers\");\nconst handleAuthApiRouteRequestForAppRouter = async ({ request, handlerContext, handlerInput, userPoolClientId, oAuthConfig, origin, setCookieOptions, runWithAmplifyServerContext, }) => {\n if (request.method !== 'GET') {\n return new Response(null, { status: 405 });\n }\n const { slug } = await handlerContext.params;\n // don't support [...slug] here\n if (slug === undefined || Array.isArray(slug)) {\n return new Response(null, { status: 400 });\n }\n if (!(0, utils_1.isSupportedAuthApiRoutePath)(slug)) {\n return new Response(null, { status: 404 });\n }\n switch (slug) {\n case 'sign-up': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithAppRouter)({\n request,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }),\n });\n }\n return (0, handlers_1.handleSignInSignUpRequest)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n type: 'signUp',\n userPoolClientId,\n });\n }\n case 'sign-in': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithAppRouter)({\n request,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }),\n });\n }\n return (0, handlers_1.handleSignInSignUpRequest)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n type: 'signIn',\n userPoolClientId,\n });\n }\n case 'sign-out':\n return (0, handlers_1.handleSignOutRequest)({\n oAuthConfig,\n origin,\n setCookieOptions,\n userPoolClientId,\n });\n case 'sign-in-callback':\n return (0, handlers_1.handleSignInCallbackRequest)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n userPoolClientId,\n });\n case 'sign-out-callback':\n return (0, handlers_1.handleSignOutCallbackRequest)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n setCookieOptions,\n userPoolClientId,\n });\n // default:\n // is unreachable by the guard of isSupportedAuthApiRoutePath()\n }\n};\nexports.handleAuthApiRouteRequestForAppRouter = handleAuthApiRouteRequestForAppRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,qCAAqC,GAAG,MAAM;AACtD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,qCAAqC,GAAG,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,2BAA2B,GAAG,KAAK;AAC1L,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;AAClC,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM;AAChD;AACA,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACnD,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC,EAAE;AACzD,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,IAAI;AACJ,IAAI,QAAQ,IAAI;AAChB,QAAQ,KAAK,SAAS,E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AC7D,gBAAgB,WAAW,EAAE,YAAY,CAAC,WAAW;AACrD,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,OAAO;AACvB,gBAAgB,gBAAgB;AAChC,gBAAgB,IAAI,EAAE,QAAQ;AAC9B,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,QAAQ;AACR,QAAQ,KAAK,UAAU;AACvB,YAAY,OAAO,IAAI,UAAU,CAAC,oBAAoB,EAAE;AACxD,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,QAAQ,KAAK,kBAAkB;AAC/B,YAAY,OAAO,IAAI,UAAU,CAAC,2BAA2B,EAAE;AAC/D,gBAAgB,YAAY;AAC5B,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,OAAO;AACvB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,QAAQ,KAAK,mBAAmB;AAChC,YAAY,OAAO,IAAI,UAAU,CAAC,4BAA4B,EAAE;AAChE,gBAAgB,YAAY;AAC5B,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,OAAO;AACvB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd;AACA;AACA;AACA,CAAC;AACD,OAAO,CAAC,qCAAqC,GAAG,qCAAqC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleAuthApiRouteRequestForPagesRouter.js","sources":["../../../src/auth/handleAuthApiRouteRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleAuthApiRouteRequestForPagesRouter = void 0;\nconst utils_1 = require(\"./utils\");\nconst handlers_1 = require(\"./handlers\");\nconst handleAuthApiRouteRequestForPagesRouter = async ({ request, response, userPoolClientId, oAuthConfig, handlerInput, origin, setCookieOptions, runWithAmplifyServerContext, }) => {\n if (request.method !== 'GET') {\n response.status(405).end();\n return;\n }\n const { slug } = request.query;\n // don't support [...slug] here\n if (slug === undefined || Array.isArray(slug)) {\n response.status(400).end();\n return;\n }\n if (!(0, utils_1.isSupportedAuthApiRoutePath)(slug)) {\n response.status(404).end();\n return;\n }\n switch (slug) {\n case 'sign-up': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithPagesRouter)({\n request,\n response,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete));\n return;\n }\n (0, handlers_1.handleSignInSignUpRequestForPagesRouter)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n type: 'signUp',\n userPoolClientId,\n });\n break;\n }\n case 'sign-in': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithPagesRouter)({\n request,\n response,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete));\n return;\n }\n (0, handlers_1.handleSignInSignUpRequestForPagesRouter)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n type: 'signIn',\n userPoolClientId,\n });\n break;\n }\n case 'sign-out':\n (0, handlers_1.handleSignOutRequestForPagesRouter)({\n oAuthConfig,\n origin,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n case 'sign-in-callback':\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handlers_1.handleSignInCallbackRequestForPagesRouter)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n case 'sign-out-callback':\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handlers_1.handleSignOutCallbackRequestForPagesRouter)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n // default:\n // is unreachable by the guard of isSupportedAuthApiRoutePath()\n }\n};\nexports.handleAuthApiRouteRequestForPagesRouter = handleAuthApiRouteRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,uCAAuC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,2BAA2B,GAAG,KAAK;AACtL,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;AAClC,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"handleAuthApiRouteRequestForPagesRouter.js","sources":["../../../src/auth/handleAuthApiRouteRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleAuthApiRouteRequestForPagesRouter = void 0;\nconst utils_1 = require(\"./utils\");\nconst handlers_1 = require(\"./handlers\");\nconst handleAuthApiRouteRequestForPagesRouter = async ({ request, response, userPoolClientId, oAuthConfig, handlerInput, origin, setCookieOptions, runWithAmplifyServerContext, }) => {\n if (request.method !== 'GET') {\n response.status(405).end();\n return;\n }\n const { slug } = request.query;\n // don't support [...slug] here\n if (slug === undefined || Array.isArray(slug)) {\n response.status(400).end();\n return;\n }\n if (!(0, utils_1.isSupportedAuthApiRoutePath)(slug)) {\n response.status(404).end();\n return;\n }\n switch (slug) {\n case 'sign-up': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithPagesRouter)({\n request,\n response,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete));\n return;\n }\n (0, handlers_1.handleSignInSignUpRequestForPagesRouter)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n type: 'signUp',\n userPoolClientId,\n });\n break;\n }\n case 'sign-in': {\n const hasActiveUserSession = await (0, utils_1.hasActiveUserSessionWithPagesRouter)({\n request,\n response,\n runWithAmplifyServerContext,\n });\n if (hasActiveUserSession) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete));\n return;\n }\n (0, handlers_1.handleSignInSignUpRequestForPagesRouter)({\n customState: handlerInput.customState,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n type: 'signIn',\n userPoolClientId,\n });\n break;\n }\n case 'sign-out':\n (0, handlers_1.handleSignOutRequestForPagesRouter)({\n oAuthConfig,\n origin,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n case 'sign-in-callback':\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handlers_1.handleSignInCallbackRequestForPagesRouter)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n case 'sign-out-callback':\n // In pages router the response is sent via calling `response.end()` or\n // `response.send()`. The response is not returned from the handler.\n // To ensure these two methods are called before the handler returns,\n // we use `await` here.\n await (0, handlers_1.handleSignOutCallbackRequestForPagesRouter)({\n handlerInput,\n oAuthConfig,\n origin,\n request,\n response,\n setCookieOptions,\n userPoolClientId,\n });\n break;\n // default:\n // is unreachable by the guard of isSupportedAuthApiRoutePath()\n }\n};\nexports.handleAuthApiRouteRequestForPagesRouter = handleAuthApiRouteRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC;AAClC,MAAM,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC;AACxC,MAAM,uCAAuC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,gBAAgB,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,EAAE,gBAAgB,EAAE,2BAA2B,GAAG,KAAK;AACtL,IAAI,IAAI,OAAO,CAAC,MAAM,KAAK,KAAK,EAAE;AAClC,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK;AAClC;AACA,IAAI,IAAI,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;AACnD,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR,IAAI;AACJ,IAAI,IAAI,CAAC,IAAI,OAAO,CAAC,2BAA2B,EAAE,IAAI,CAAC,EAAE;AACzD,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR,IAAI;AACJ,IAAI,QAAQ,IAAI;AA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,EAAE,QAAQ;AAC9B,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,YAAY;AACZ,QAAQ;AACR,QAAQ,KAAK,UAAU;AACvB,YAAY,IAAI,UAAU,CAAC,kCAAkC,EAAE;AAC/D,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,QAAQ;AACxB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,YAAY;AACZ,QAAQ,KAAK,kBAAkB;AAC/B;AACA;AACA;AACA;AACA,YAAY,MAAM,IAAI,UAAU,CAAC,yCAAyC,EAAE;AAC5E,gBAAgB,YAAY;AAC5B,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,YAAY;AACZ,QAAQ,KAAK,mBAAmB;AAChC;AACA;AACA;AACA;AACA,YAAY,MAAM,IAAI,UAAU,CAAC,0CAA0C,EAAE;AAC7E,gBAAgB,YAAY;AAC5B,gBAAgB,WAAW;AAC3B,gBAAgB,MAAM;AACtB,gBAAgB,OAAO;AACvB,gBAAgB,QAAQ;AACxB,gBAAgB,gBAAgB;AAChC,gBAAgB,gBAAgB;AAChC,aAAa,CAAC;AACd,YAAY;AACZ;AACA;AACA;AACA,CAAC;AACD,OAAO,CAAC,uCAAuC,GAAG,uCAAuC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSignInCallbackRequest.js","sources":["../../../../src/auth/handlers/handleSignInCallbackRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignInCallbackRequest = void 0;\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignInCallbackRequest = async ({ request, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { code, state, error, errorDescription } = (0, utils_1.parseSignInCallbackUrl)(request.url);\n if (errorDescription || error) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error,\n errorDescription,\n });\n return new Response(null, {\n status: 302,\n headers: new Headers({\n location: `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`,\n }),\n });\n }\n if (!code || !state) {\n return new Response(null, { status: 400 });\n }\n const { [constant_1.PKCE_COOKIE_NAME]: clientPkce, [constant_1.STATE_COOKIE_NAME]: clientState } = (0, utils_1.getCookieValuesFromRequest)(request, [constant_1.PKCE_COOKIE_NAME, constant_1.STATE_COOKIE_NAME]);\n // The state and pkce cookies are removed from cookie store after 5 minutes\n if (!clientState || !clientPkce) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error: constant_1.SIGN_IN_TIMEOUT_ERROR_CODE,\n errorDescription: constant_1.SIGN_IN_TIMEOUT_ERROR_MESSAGE,\n });\n return new Response(null, {\n status: 302,\n headers: new Headers({\n location: `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`,\n }),\n });\n }\n // Most likely the cookie has been tampered\n if (clientState !== state) {\n return new Response(null, { status: 400 });\n }\n const tokensPayload = await (0, utils_1.exchangeAuthNTokens)({\n redirectUri: (0, utils_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n userPoolClientId,\n oAuthConfig,\n code,\n codeVerifier: clientPkce,\n });\n if ('error' in tokensPayload) {\n return new Response(tokensPayload.error, { status: 500 });\n }\n const headers = new Headers();\n (0, utils_1.appendSetCookieHeaders)(headers, (0, utils_1.createTokenCookies)({\n tokensPayload,\n userPoolClientId,\n }), (0, utils_1.createTokenCookiesSetOptions)(setCookieOptions, origin));\n (0, utils_1.appendSetCookieHeaders)(headers, (0, utils_1.createSignInFlowProofCookies)({ state: '', pkce: '' }), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n // When Cognito redirects back to `/sign-in-callback`, the referer is Cognito\n // endpoint. If redirect end user to `redirectOnSignInComplete` from this point,\n // the referer remains the same.\n // When authN token cookies set as `sameSite: 'strict'`, this may cause the\n // authN tokens cookies set with the redirect response not to be sent to the\n // server. Hence, sending a html page with status 200 to the client, and perform\n // the redirection on the client side.\n headers.set('Content-Type', 'text/html');\n return new Response((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }), {\n status: 200,\n headers,\n });\n};\nexports.handleSignInCallbackRequest = handleSignInCallbackRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,2BAA2B,GAAG,MAAM;AAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,2BAA2B,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AACnI,IAAI,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC;AACrG,IAAI,IAAI,gBAAgB,IAAI,KAAK,EAAE;AACnC,QAAQ,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,6BAA6B,EAAE;AAC9E,YAAY,KAAK;AACjB,YAAY,gBAAgB;AAC5B,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE;AAClC,YAAY,MAAM,EAAE,GAAG;AACvB,YAAY,OAAO,EAAE,IAAI,OAAO,CAAC;AACjC,gBAAgB,QAAQ,EAAE,CAAC,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAC9H,aAAa,CAAC;AACd,SAAS,CAAC;AACV;
|
|
1
|
+
{"version":3,"file":"handleSignInCallbackRequest.js","sources":["../../../../src/auth/handlers/handleSignInCallbackRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignInCallbackRequest = void 0;\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignInCallbackRequest = async ({ request, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { code, state, error, errorDescription } = (0, utils_1.parseSignInCallbackUrl)(request.url);\n if (errorDescription || error) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error,\n errorDescription,\n });\n return new Response(null, {\n status: 302,\n headers: new Headers({\n location: `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`,\n }),\n });\n }\n if (!code || !state) {\n return new Response(null, { status: 400 });\n }\n const { [constant_1.PKCE_COOKIE_NAME]: clientPkce, [constant_1.STATE_COOKIE_NAME]: clientState } = (0, utils_1.getCookieValuesFromRequest)(request, [constant_1.PKCE_COOKIE_NAME, constant_1.STATE_COOKIE_NAME]);\n // The state and pkce cookies are removed from cookie store after 5 minutes\n if (!clientState || !clientPkce) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error: constant_1.SIGN_IN_TIMEOUT_ERROR_CODE,\n errorDescription: constant_1.SIGN_IN_TIMEOUT_ERROR_MESSAGE,\n });\n return new Response(null, {\n status: 302,\n headers: new Headers({\n location: `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`,\n }),\n });\n }\n // Most likely the cookie has been tampered\n if (clientState !== state) {\n return new Response(null, { status: 400 });\n }\n const tokensPayload = await (0, utils_1.exchangeAuthNTokens)({\n redirectUri: (0, utils_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n userPoolClientId,\n oAuthConfig,\n code,\n codeVerifier: clientPkce,\n });\n if ('error' in tokensPayload) {\n return new Response(tokensPayload.error, { status: 500 });\n }\n const headers = new Headers();\n (0, utils_1.appendSetCookieHeaders)(headers, (0, utils_1.createTokenCookies)({\n tokensPayload,\n userPoolClientId,\n }), (0, utils_1.createTokenCookiesSetOptions)(setCookieOptions, origin));\n (0, utils_1.appendSetCookieHeaders)(headers, (0, utils_1.createSignInFlowProofCookies)({ state: '', pkce: '' }), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n // When Cognito redirects back to `/sign-in-callback`, the referer is Cognito\n // endpoint. If redirect end user to `redirectOnSignInComplete` from this point,\n // the referer remains the same.\n // When authN token cookies set as `sameSite: 'strict'`, this may cause the\n // authN tokens cookies set with the redirect response not to be sent to the\n // server. Hence, sending a html page with status 200 to the client, and perform\n // the redirection on the client side.\n headers.set('Content-Type', 'text/html');\n return new Response((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }), {\n status: 200,\n headers,\n });\n};\nexports.handleSignInCallbackRequest = handleSignInCallbackRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,2BAA2B,GAAG,MAAM;AAC5C,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,2BAA2B,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,E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A4B,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,OAAO,CAAC,uCAAuC,EAAE,gBAAgB,CAAC,CAAC;AAC5L;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC;AAC5C,IAAI,OAAO,IAAI,QAAQ,CAAC,IAAI,OAAO,CAAC,6BAA6B,EAAE;AACnE,QAAQ,UAAU,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,wBAAwB,CAAC;AAC5F,KAAK,CAAC,EAAE;AACR,QAAQ,MAAM,EAAE,GAAG;AACnB,QAAQ,OAAO;AACf,KAAK,CAAC;AACN,CAAC;AACD,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSignInCallbackRequestForPagesRouter.js","sources":["../../../../src/auth/handlers/handleSignInCallbackRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignInCallbackRequestForPagesRouter = void 0;\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignInCallbackRequestForPagesRouter = async ({ request, response, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { code, state, error, errorDescription } = (0, utils_1.parseSignInCallbackUrl)(request.url);\n if (errorDescription || error) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error,\n errorDescription,\n });\n response.redirect(302, `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`);\n return;\n }\n if (!code || !state) {\n response.status(400).end();\n return;\n }\n const { [constant_1.PKCE_COOKIE_NAME]: clientPkce, [constant_1.STATE_COOKIE_NAME]: clientState } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n constant_1.PKCE_COOKIE_NAME,\n constant_1.STATE_COOKIE_NAME,\n ]);\n // The state and pkce cookies are removed from cookie store after 5 minutes\n if (!clientState || !clientPkce) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error: constant_1.SIGN_IN_TIMEOUT_ERROR_CODE,\n errorDescription: constant_1.SIGN_IN_TIMEOUT_ERROR_MESSAGE,\n });\n response.redirect(302, `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`);\n return;\n }\n // Most likely the cookie has been tampered\n if (clientState !== state) {\n response.status(400).end();\n return;\n }\n const tokensPayload = await (0, utils_1.exchangeAuthNTokens)({\n redirectUri: (0, utils_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n userPoolClientId,\n oAuthConfig,\n code,\n codeVerifier: clientPkce,\n });\n if ('error' in tokensPayload) {\n response.status(500).send(tokensPayload.error);\n return;\n }\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, (0, utils_1.createTokenCookies)({\n tokensPayload,\n userPoolClientId,\n }), (0, utils_1.createTokenCookiesSetOptions)(setCookieOptions, origin));\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, (0, utils_1.createSignInFlowProofCookies)({ state: '', pkce: '' }), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n // When Cognito redirects back to `/sign-in-callback`, the referer is Cognito\n // endpoint. If redirect end user to `redirectOnSignInComplete` from this point,\n // the referer remains the same.\n // When authN token cookies set as `sameSite: 'strict'`, this may cause the\n // authN tokens cookies set with the redirect response not to be sent to the\n // server. Hence, sending a html page with status 200 to the client, and perform\n // the redirection on the client side.\n response\n .appendHeader('Content-Type', 'text/html')\n .status(200)\n .send((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }));\n};\nexports.handleSignInCallbackRequestForPagesRouter = handleSignInCallbackRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yCAAyC,GAAG,MAAM;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,yCAAyC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AAC3J,IAAI,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC;AACrG,IAAI,IAAI,gBAAgB,IAAI,KAAK,EAAE;AACnC,QAAQ,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,6BAA6B,EAAE;AAC9E,YAAY,KAAK;AACjB,YAAY,gBAAgB;AAC5B,SAAS,CAAC;AACV,QAAQ,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,kBAAkB,CAAC,CAAC,CAAC;AACpI,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"handleSignInCallbackRequestForPagesRouter.js","sources":["../../../../src/auth/handlers/handleSignInCallbackRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignInCallbackRequestForPagesRouter = void 0;\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignInCallbackRequestForPagesRouter = async ({ request, response, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { code, state, error, errorDescription } = (0, utils_1.parseSignInCallbackUrl)(request.url);\n if (errorDescription || error) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error,\n errorDescription,\n });\n response.redirect(302, `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`);\n return;\n }\n if (!code || !state) {\n response.status(400).end();\n return;\n }\n const { [constant_1.PKCE_COOKIE_NAME]: clientPkce, [constant_1.STATE_COOKIE_NAME]: clientState } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n constant_1.PKCE_COOKIE_NAME,\n constant_1.STATE_COOKIE_NAME,\n ]);\n // The state and pkce cookies are removed from cookie store after 5 minutes\n if (!clientState || !clientPkce) {\n const searchParamsString = (0, utils_1.createErrorSearchParamsString)({\n error: constant_1.SIGN_IN_TIMEOUT_ERROR_CODE,\n errorDescription: constant_1.SIGN_IN_TIMEOUT_ERROR_MESSAGE,\n });\n response.redirect(302, `${(0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete)}?${searchParamsString}`);\n return;\n }\n // Most likely the cookie has been tampered\n if (clientState !== state) {\n response.status(400).end();\n return;\n }\n const tokensPayload = await (0, utils_1.exchangeAuthNTokens)({\n redirectUri: (0, utils_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n userPoolClientId,\n oAuthConfig,\n code,\n codeVerifier: clientPkce,\n });\n if ('error' in tokensPayload) {\n response.status(500).send(tokensPayload.error);\n return;\n }\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, (0, utils_1.createTokenCookies)({\n tokensPayload,\n userPoolClientId,\n }), (0, utils_1.createTokenCookiesSetOptions)(setCookieOptions, origin));\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, (0, utils_1.createSignInFlowProofCookies)({ state: '', pkce: '' }), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n // When Cognito redirects back to `/sign-in-callback`, the referer is Cognito\n // endpoint. If redirect end user to `redirectOnSignInComplete` from this point,\n // the referer remains the same.\n // When authN token cookies set as `sameSite: 'strict'`, this may cause the\n // authN tokens cookies set with the redirect response not to be sent to the\n // server. Hence, sending a html page with status 200 to the client, and perform\n // the redirection on the client side.\n response\n .appendHeader('Content-Type', 'text/html')\n .status(200)\n .send((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignInComplete),\n }));\n};\nexports.handleSignInCallbackRequestForPagesRouter = handleSignInCallbackRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,yCAAyC,GAAG,MAAM;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,yCAAyC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AAC3J,IAAI,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,GAAG,IAAI,OAAO,CAAC,sBAAsB,EAAE,OAAO,CAAC,GAAG,CAAC;AACrG,IAAI,IAAI,gBAAgB,IAAI,KAAK,EAAE;AACnC,QAAQ,MAAM,kBAAkB,GAAG,IAAI,OAAO,CAAC,6BAA6B,EAAE;AAC9E,YAAY,KAAK;AACjB,YAAY,gBAAgB;AAC5B,SAAS,CAAC;AACV,QAAQ,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,CAAC,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,kBAAkB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AAY,EAAE,UAAU;AAChC,KAAK,CAAC;AACN,IAAI,IAAI,OAAO,IAAI,aAAa,EAAE;AAClC,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC;AACtD,QAAQ;AACR,IAAI;AACJ,IAAI,IAAI,OAAO,CAAC,uCAAuC,EAAE,QAAQ,EAAE,IAAI,OAAO,CAAC,kBAAkB,EAAE;AACnG,QAAQ,aAAa;AACrB,QAAQ,gBAAgB;AACxB,KAAK,CAAC,EAAE,IAAI,OAAO,CAAC,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,CAAC,CAAC;AAC5E,IAAI,IAAI,OAAO,CAAC,uCAAuC,EAAE,QAAQ,EAAE,IAAI,OAAO,CAAC,4BAA4B,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,OAAO,CAAC,uCAAuC,EAAE,gBAAgB,CAAC,CAAC;AAC9M;AACA;AACA;AACA;AACA;AACA;AACA;AACA,IAAI;AACJ,SAAS,YAAY,CAAC,cAAc,EAAE,WAAW;AACjD,SAAS,MAAM,CAAC,GAAG;AACnB,SAAS,IAAI,CAAC,IAAI,OAAO,CAAC,6BAA6B,EAAE;AACzD,QAAQ,UAAU,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,wBAAwB,CAAC;AAC5F,KAAK,CAAC,CAAC;AACP,CAAC;AACD,OAAO,CAAC,yCAAyC,GAAG,yCAAyC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handleSignOutCallbackRequest.js","sources":["../../../../src/auth/handlers/handleSignOutCallbackRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutCallbackRequest = void 0;\nconst adapter_core_1 = require(\"aws-amplify/adapter-core\");\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignOutCallbackRequest = async ({ request, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { [constant_1.IS_SIGNING_OUT_COOKIE_NAME]: isSigningOut, [constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]: isSigningOutRedirecting, } = (0, utils_1.getCookieValuesFromRequest)(request, [\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME,\n ]);\n if (!isSigningOut) {\n return new Response(null, { status: 400 });\n }\n // When Cognito /logout endpoint redirects back, response has code 302, the browsers (Safari and Firefox)\n // assume the incoming request is a cross-site request and block the cookies.\n // To workaround this issue, we send an intermediate page with 200 response. This page will redirect\n // to the /sign-out-callback (this handler) again, since it's the same-site request, the cookies will be\n // sent back to the server.\n if (isSigningOutRedirecting) {\n const headers = new Headers();\n headers.set('Content-Type', 'text/html');\n (0, utils_1.appendSetCookieHeaders)(headers, \n // remove the IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME cookie to the next request to this\n // handler can proceed.\n (0, utils_1.createTokenRemoveCookies)([constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n return new Response((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.resolveRedirectSignOutUrl)(origin, oAuthConfig),\n }), {\n status: 200,\n headers,\n });\n }\n const lastAuthUserCookieName = `${adapter_core_1.AUTH_KEY_PREFIX}.${userPoolClientId}.LastAuthUser`;\n const { [lastAuthUserCookieName]: username } = (0, utils_1.getCookieValuesFromRequest)(request, [lastAuthUserCookieName]);\n if (!username) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete),\n }),\n });\n }\n const authCookiesKeys = (0, adapter_core_1.createKeysForAuthStorage)(adapter_core_1.AUTH_KEY_PREFIX, `${userPoolClientId}.${username}`);\n const { [authCookiesKeys.refreshToken]: refreshToken } = (0, utils_1.getCookieValuesFromRequest)(request, [authCookiesKeys.refreshToken]);\n if (!refreshToken) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete),\n }),\n });\n }\n const result = await (0, utils_1.revokeAuthNTokens)({\n refreshToken,\n userPoolClientId,\n endpointDomain: oAuthConfig.domain,\n });\n if (result.error) {\n return new Response(result.error, { status: 500 });\n }\n const headers = new Headers();\n (0, utils_1.appendSetCookieHeaders)(headers, [\n ...(0, utils_1.createTokenRemoveCookies)([\n authCookiesKeys.accessToken,\n authCookiesKeys.idToken,\n authCookiesKeys.refreshToken,\n lastAuthUserCookieName,\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n ]),\n ], (0, utils_1.createTokenCookiesRemoveOptions)(setCookieOptions));\n headers.set('Location', (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return new Response(null, {\n status: 302,\n headers,\n });\n};\nexports.handleSignOutCallbackRequest = handleSignOutCallbackRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,4BAA4B,GAAG,MAAM;AAC7C,MAAM,cAAc,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,4BAA4B,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AACpI,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,0BAA0B,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,sCAAsC,GAAG,uBAAuB,GAAG,GAAG,IAAI,OAAO,CAAC,0BAA0B,EAAE,OAAO,EAAE;AACtM,QAAQ,UAAU,CAAC,0BAA0B;AAC7C,QAAQ,UAAU,CAAC,sCAAsC;AACzD,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD;
|
|
1
|
+
{"version":3,"file":"handleSignOutCallbackRequest.js","sources":["../../../../src/auth/handlers/handleSignOutCallbackRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutCallbackRequest = void 0;\nconst adapter_core_1 = require(\"aws-amplify/adapter-core\");\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignOutCallbackRequest = async ({ request, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { [constant_1.IS_SIGNING_OUT_COOKIE_NAME]: isSigningOut, [constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]: isSigningOutRedirecting, } = (0, utils_1.getCookieValuesFromRequest)(request, [\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME,\n ]);\n if (!isSigningOut) {\n return new Response(null, { status: 400 });\n }\n // When Cognito /logout endpoint redirects back, response has code 302, the browsers (Safari and Firefox)\n // assume the incoming request is a cross-site request and block the cookies.\n // To workaround this issue, we send an intermediate page with 200 response. This page will redirect\n // to the /sign-out-callback (this handler) again, since it's the same-site request, the cookies will be\n // sent back to the server.\n if (isSigningOutRedirecting) {\n const headers = new Headers();\n headers.set('Content-Type', 'text/html');\n (0, utils_1.appendSetCookieHeaders)(headers, \n // remove the IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME cookie to the next request to this\n // handler can proceed.\n (0, utils_1.createTokenRemoveCookies)([constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n return new Response((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.resolveRedirectSignOutUrl)(origin, oAuthConfig),\n }), {\n status: 200,\n headers,\n });\n }\n const lastAuthUserCookieName = `${adapter_core_1.AUTH_KEY_PREFIX}.${userPoolClientId}.LastAuthUser`;\n const { [lastAuthUserCookieName]: username } = (0, utils_1.getCookieValuesFromRequest)(request, [lastAuthUserCookieName]);\n if (!username) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete),\n }),\n });\n }\n const authCookiesKeys = (0, adapter_core_1.createKeysForAuthStorage)(adapter_core_1.AUTH_KEY_PREFIX, `${userPoolClientId}.${username}`);\n const { [authCookiesKeys.refreshToken]: refreshToken } = (0, utils_1.getCookieValuesFromRequest)(request, [authCookiesKeys.refreshToken]);\n if (!refreshToken) {\n return new Response(null, {\n status: 302,\n headers: new Headers({\n Location: (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete),\n }),\n });\n }\n const result = await (0, utils_1.revokeAuthNTokens)({\n refreshToken,\n userPoolClientId,\n endpointDomain: oAuthConfig.domain,\n });\n if (result.error) {\n return new Response(result.error, { status: 500 });\n }\n const headers = new Headers();\n (0, utils_1.appendSetCookieHeaders)(headers, [\n ...(0, utils_1.createTokenRemoveCookies)([\n authCookiesKeys.accessToken,\n authCookiesKeys.idToken,\n authCookiesKeys.refreshToken,\n lastAuthUserCookieName,\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n ]),\n ], (0, utils_1.createTokenCookiesRemoveOptions)(setCookieOptions));\n headers.set('Location', (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return new Response(null, {\n status: 302,\n headers,\n });\n};\nexports.handleSignOutCallbackRequest = handleSignOutCallbackRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,4BAA4B,GAAG,MAAM;AAC7C,MAAM,cAAc,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,4BAA4B,GAAG,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AACpI,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,0BAA0B,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,sCAAsC,GAAG,uBAAuB,GAAG,GAAG,IAAI,OAAO,CAAC,0BAA0B,EAAE,OAAO,EAAE;AACtM,QAAQ,UAAU,CAAC,0BAA0B;AAC7C,QAAQ,UAAU,CAAC,sCAAsC;AACzD,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC;AAClD,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,uBAAuB,EAAE;AACjC,QAAQ,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE;AACrC,QAAQ,OAAO,CAAC,GAAG,CAAC,cAAc,EAAE,WAAW,CAAC;AAChD,QAAQ,IAAI,OAAO,CAAC,sBAAsB,EAAE,OAAO;AACnD;AACA;AACA,QAAQ,IAAI,OAAO,CAAC,wBAAwB,EAAE,CAAC,UAAU,CAAC,sCAAsC,CAAC,CAAC,EAAE,IA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|
-
{"version":3,"file":"handleSignOutCallbackRequestForPagesRouter.js","sources":["../../../../src/auth/handlers/handleSignOutCallbackRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutCallbackRequestForPagesRouter = void 0;\nconst adapter_core_1 = require(\"aws-amplify/adapter-core\");\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignOutCallbackRequestForPagesRouter = async ({ request, response, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { [constant_1.IS_SIGNING_OUT_COOKIE_NAME]: isSigningOut, [constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]: isSigningOutRedirecting, } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME,\n ]);\n if (!isSigningOut) {\n response.status(400).end();\n return;\n }\n // When Cognito /logout endpoint redirects back, response has code 302, the browsers (Safari and Firefox)\n // assume the incoming request is a cross-site request and block the cookies.\n // To workaround this issue, we send an intermediate page with 200 response. This page will redirect\n // to the /sign-out-callback (this handler) again, since it's the same-site request, the cookies will be\n // sent back to the server.\n if (isSigningOutRedirecting) {\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, \n // remove the IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME cookie to the next request to this\n // handler can proceed.\n (0, utils_1.createTokenRemoveCookies)([constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n response\n .appendHeader('Content-Type', 'text/html')\n .status(200)\n .send((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.resolveRedirectSignOutUrl)(origin, oAuthConfig),\n }));\n return;\n }\n const lastAuthUserCookieName = `${adapter_core_1.AUTH_KEY_PREFIX}.${userPoolClientId}.LastAuthUser`;\n const { [lastAuthUserCookieName]: username } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [lastAuthUserCookieName]);\n if (!username) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return;\n }\n const authCookiesKeys = (0, adapter_core_1.createKeysForAuthStorage)(adapter_core_1.AUTH_KEY_PREFIX, `${userPoolClientId}.${username}`);\n const { [authCookiesKeys.refreshToken]: refreshToken } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n authCookiesKeys.refreshToken,\n ]);\n if (!refreshToken) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return;\n }\n const result = await (0, utils_1.revokeAuthNTokens)({\n refreshToken,\n userPoolClientId,\n endpointDomain: oAuthConfig.domain,\n });\n if (result.error) {\n response.status(500).send(result.error);\n return;\n }\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, [\n ...(0, utils_1.createTokenRemoveCookies)([\n authCookiesKeys.accessToken,\n authCookiesKeys.idToken,\n authCookiesKeys.refreshToken,\n lastAuthUserCookieName,\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n ]),\n ], (0, utils_1.createTokenCookiesRemoveOptions)(setCookieOptions));\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n};\nexports.handleSignOutCallbackRequestForPagesRouter = handleSignOutCallbackRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0CAA0C,GAAG,MAAM;AAC3D,MAAM,cAAc,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,0CAA0C,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AAC5J,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,0BAA0B,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,sCAAsC,GAAG,uBAAuB,GAAG,GAAG,IAAI,OAAO,CAAC,iCAAiC,EAAE,OAAO,EAAE;AAC7M,QAAQ,UAAU,CAAC,0BAA0B;AAC7C,QAAQ,UAAU,CAAC,sCAAsC;AACzD,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR;
|
|
1
|
+
{"version":3,"file":"handleSignOutCallbackRequestForPagesRouter.js","sources":["../../../../src/auth/handlers/handleSignOutCallbackRequestForPagesRouter.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutCallbackRequestForPagesRouter = void 0;\nconst adapter_core_1 = require(\"aws-amplify/adapter-core\");\nconst constant_1 = require(\"../constant\");\nconst utils_1 = require(\"../utils\");\nconst handleSignOutCallbackRequestForPagesRouter = async ({ request, response, handlerInput, userPoolClientId, oAuthConfig, setCookieOptions, origin, }) => {\n const { [constant_1.IS_SIGNING_OUT_COOKIE_NAME]: isSigningOut, [constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]: isSigningOutRedirecting, } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME,\n ]);\n if (!isSigningOut) {\n response.status(400).end();\n return;\n }\n // When Cognito /logout endpoint redirects back, response has code 302, the browsers (Safari and Firefox)\n // assume the incoming request is a cross-site request and block the cookies.\n // To workaround this issue, we send an intermediate page with 200 response. This page will redirect\n // to the /sign-out-callback (this handler) again, since it's the same-site request, the cookies will be\n // sent back to the server.\n if (isSigningOutRedirecting) {\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, \n // remove the IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME cookie to the next request to this\n // handler can proceed.\n (0, utils_1.createTokenRemoveCookies)([constant_1.IS_SIGNING_OUT_REDIRECTING_COOKIE_NAME]), (0, utils_1.createAuthFlowProofCookiesRemoveOptions)(setCookieOptions));\n response\n .appendHeader('Content-Type', 'text/html')\n .status(200)\n .send((0, utils_1.createRedirectionIntermediary)({\n redirectTo: (0, utils_1.resolveRedirectSignOutUrl)(origin, oAuthConfig),\n }));\n return;\n }\n const lastAuthUserCookieName = `${adapter_core_1.AUTH_KEY_PREFIX}.${userPoolClientId}.LastAuthUser`;\n const { [lastAuthUserCookieName]: username } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [lastAuthUserCookieName]);\n if (!username) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return;\n }\n const authCookiesKeys = (0, adapter_core_1.createKeysForAuthStorage)(adapter_core_1.AUTH_KEY_PREFIX, `${userPoolClientId}.${username}`);\n const { [authCookiesKeys.refreshToken]: refreshToken } = (0, utils_1.getCookieValuesFromNextApiRequest)(request, [\n authCookiesKeys.refreshToken,\n ]);\n if (!refreshToken) {\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n return;\n }\n const result = await (0, utils_1.revokeAuthNTokens)({\n refreshToken,\n userPoolClientId,\n endpointDomain: oAuthConfig.domain,\n });\n if (result.error) {\n response.status(500).send(result.error);\n return;\n }\n (0, utils_1.appendSetCookieHeadersToNextApiResponse)(response, [\n ...(0, utils_1.createTokenRemoveCookies)([\n authCookiesKeys.accessToken,\n authCookiesKeys.idToken,\n authCookiesKeys.refreshToken,\n lastAuthUserCookieName,\n constant_1.IS_SIGNING_OUT_COOKIE_NAME,\n ]),\n ], (0, utils_1.createTokenCookiesRemoveOptions)(setCookieOptions));\n response.redirect(302, (0, utils_1.getRedirectOrDefault)(handlerInput.redirectOnSignOutComplete));\n};\nexports.handleSignOutCallbackRequestForPagesRouter = handleSignOutCallbackRequestForPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0CAA0C,GAAG,MAAM;AAC3D,MAAM,cAAc,GAAG,OAAO,CAAC,0BAA0B,CAAC;AAC1D,MAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC;AACzC,MAAM,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;AACnC,MAAM,0CAA0C,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,gBAAgB,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,GAAG,KAAK;AAC5J,IAAI,MAAM,EAAE,CAAC,UAAU,CAAC,0BAA0B,GAAG,YAAY,EAAE,CAAC,UAAU,CAAC,sCAAsC,GAAG,uBAAuB,GAAG,GAAG,IAAI,OAAO,CAAC,iCAAiC,EAAE,OAAO,EAAE;AAC7M,QAAQ,UAAU,CAAC,0BAA0B;AAC7C,QAAQ,UAAU,CAAC,sCAAsC;AACzD,KAAK,CAAC;AACN,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE;AAClC,QAAQ;AACR,IAAI;AACJ;AACA;AACA;AACA;AACA;AACA,IAAI,IAAI,uBAAuB,EAAE;AACjC,QAAQ,IAAI,OAAO,CAAC,uCAAuC,EAAE,QAAQ;AACrE;AACA;AAC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E,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACzG,QAAQ;AACR,IAAI;AACJ,IAAI,MAAM,MAAM,GAAG,MAAM,IAAI,OAAO,CAAC,iBAAiB,EAAE;AACxD,QAAQ,YAAY;AACpB,QAAQ,gBAAgB;AACxB,QAAQ,cAAc,EAAE,WAAW,CAAC,MAAM;AAC1C,KAAK,CAAC;AACN,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE;AACtB,QAAQ,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC;AAC/C,QAAQ;AACR,IAAI;AACJ,IAAI,IAAI,OAAO,CAAC,uCAAuC,EAAE,QAAQ,EAAE;AACnE,QAAQ,GAAG,IAAI,OAAO,CAAC,wBAAwB,EAAE;AACjD,YAAY,eAAe,CAAC,WAAW;AACvC,YAAY,eAAe,CAAC,OAAO;AACnC,YAAY,eAAe,CAAC,YAAY;AACxC,YAAY,sBAAsB;AAClC,YAAY,UAAU,CAAC,0BAA0B;AACjD,SAAS,CAAC;AACV,KAAK,EAAE,IAAI,OAAO,CAAC,+BAA+B,EAAE,gBAAgB,CAAC,CAAC;AACtE,IAAI,QAAQ,CAAC,QAAQ,CAAC,GAAG,EAAE,IAAI,OAAO,CAAC,oBAAoB,EAAE,YAAY,CAAC,yBAAyB,CAAC,CAAC;AACrG,CAAC;AACD,OAAO,CAAC,0CAA0C,GAAG,0CAA0C;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/auth/handlers/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutRequestForPagesRouter = exports.handleSignOutRequest = exports.handleSignOutCallbackRequestForPagesRouter = exports.handleSignOutCallbackRequest = exports.handleSignInSignUpRequestForPagesRouter = exports.handleSignInSignUpRequest = exports.handleSignInCallbackRequestForPagesRouter = exports.handleSignInCallbackRequest = void 0;\nvar handleSignInCallbackRequest_1 = require(\"./handleSignInCallbackRequest\");\nObject.defineProperty(exports, \"handleSignInCallbackRequest\", { enumerable: true, get: function () { return handleSignInCallbackRequest_1.handleSignInCallbackRequest; } });\nvar handleSignInCallbackRequestForPagesRouter_1 = require(\"./handleSignInCallbackRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignInCallbackRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignInCallbackRequestForPagesRouter_1.handleSignInCallbackRequestForPagesRouter; } });\nvar handleSignInSignUpRequest_1 = require(\"./handleSignInSignUpRequest\");\nObject.defineProperty(exports, \"handleSignInSignUpRequest\", { enumerable: true, get: function () { return handleSignInSignUpRequest_1.handleSignInSignUpRequest; } });\nvar handleSignInSignUpRequestForPagesRouter_1 = require(\"./handleSignInSignUpRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignInSignUpRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignInSignUpRequestForPagesRouter_1.handleSignInSignUpRequestForPagesRouter; } });\nvar handleSignOutCallbackRequest_1 = require(\"./handleSignOutCallbackRequest\");\nObject.defineProperty(exports, \"handleSignOutCallbackRequest\", { enumerable: true, get: function () { return handleSignOutCallbackRequest_1.handleSignOutCallbackRequest; } });\nvar handleSignOutCallbackRequestForPagesRouter_1 = require(\"./handleSignOutCallbackRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignOutCallbackRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignOutCallbackRequestForPagesRouter_1.handleSignOutCallbackRequestForPagesRouter; } });\nvar handleSignOutRequest_1 = require(\"./handleSignOutRequest\");\nObject.defineProperty(exports, \"handleSignOutRequest\", { enumerable: true, get: function () { return handleSignOutRequest_1.handleSignOutRequest; } });\nvar handleSignOutRequestForPagesRouter_1 = require(\"./handleSignOutRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignOutRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignOutRequestForPagesRouter_1.handleSignOutRequestForPagesRouter; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kCAAkC,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,uCAAuC,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,yCAAyC,GAAG,OAAO,CAAC,2BAA2B,GAAG,MAAM;AAC9V,IAAI,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,CAAC;AAC5E,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,6BAA6B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,6BAA6B,CAAC,2BAA2B,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/auth/handlers/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.handleSignOutRequestForPagesRouter = exports.handleSignOutRequest = exports.handleSignOutCallbackRequestForPagesRouter = exports.handleSignOutCallbackRequest = exports.handleSignInSignUpRequestForPagesRouter = exports.handleSignInSignUpRequest = exports.handleSignInCallbackRequestForPagesRouter = exports.handleSignInCallbackRequest = void 0;\nvar handleSignInCallbackRequest_1 = require(\"./handleSignInCallbackRequest\");\nObject.defineProperty(exports, \"handleSignInCallbackRequest\", { enumerable: true, get: function () { return handleSignInCallbackRequest_1.handleSignInCallbackRequest; } });\nvar handleSignInCallbackRequestForPagesRouter_1 = require(\"./handleSignInCallbackRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignInCallbackRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignInCallbackRequestForPagesRouter_1.handleSignInCallbackRequestForPagesRouter; } });\nvar handleSignInSignUpRequest_1 = require(\"./handleSignInSignUpRequest\");\nObject.defineProperty(exports, \"handleSignInSignUpRequest\", { enumerable: true, get: function () { return handleSignInSignUpRequest_1.handleSignInSignUpRequest; } });\nvar handleSignInSignUpRequestForPagesRouter_1 = require(\"./handleSignInSignUpRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignInSignUpRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignInSignUpRequestForPagesRouter_1.handleSignInSignUpRequestForPagesRouter; } });\nvar handleSignOutCallbackRequest_1 = require(\"./handleSignOutCallbackRequest\");\nObject.defineProperty(exports, \"handleSignOutCallbackRequest\", { enumerable: true, get: function () { return handleSignOutCallbackRequest_1.handleSignOutCallbackRequest; } });\nvar handleSignOutCallbackRequestForPagesRouter_1 = require(\"./handleSignOutCallbackRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignOutCallbackRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignOutCallbackRequestForPagesRouter_1.handleSignOutCallbackRequestForPagesRouter; } });\nvar handleSignOutRequest_1 = require(\"./handleSignOutRequest\");\nObject.defineProperty(exports, \"handleSignOutRequest\", { enumerable: true, get: function () { return handleSignOutRequest_1.handleSignOutRequest; } });\nvar handleSignOutRequestForPagesRouter_1 = require(\"./handleSignOutRequestForPagesRouter\");\nObject.defineProperty(exports, \"handleSignOutRequestForPagesRouter\", { enumerable: true, get: function () { return handleSignOutRequestForPagesRouter_1.handleSignOutRequestForPagesRouter; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,kCAAkC,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,0CAA0C,GAAG,OAAO,CAAC,4BAA4B,GAAG,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AC9K,IAAI,4CAA4C,GAAG,OAAO,CAAC,8CAA8C,CAAC;AAC1G,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,4CAA4C,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,4CAA4C,CAAC,0CAA0C,CAAC,CAAC,CAAC,EAAE,CAAC;AACxN,IAAI,sBAAsB,GAAG,OAAO,CAAC,wBAAwB,CAAC;AAC9D,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,sBAAsB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,sBAAsB,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,CAAC;AACtJ,IAAI,oCAAoC,GAAG,OAAO,CAAC,sCAAsC,CAAC;AAC1F,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oCAAoC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,oCAAoC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/auth/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createAuthRouteHandlersFactory = void 0;\nvar createAuthRouteHandlersFactory_1 = require(\"./createAuthRouteHandlersFactory\");\nObject.defineProperty(exports, \"createAuthRouteHandlersFactory\", { enumerable: true, get: function () { return createAuthRouteHandlersFactory_1.createAuthRouteHandlersFactory; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,8BAA8B,GAAG,MAAM;AAC/C,IAAI,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAClF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gCAAgC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gCAAgC,CAAC,8BAA8B,CAAC,
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/auth/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createAuthRouteHandlersFactory = void 0;\nvar createAuthRouteHandlersFactory_1 = require(\"./createAuthRouteHandlersFactory\");\nObject.defineProperty(exports, \"createAuthRouteHandlersFactory\", { enumerable: true, get: function () { return createAuthRouteHandlersFactory_1.createAuthRouteHandlersFactory; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,8BAA8B,GAAG,MAAM;AAC/C,IAAI,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC;AAClF,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,gCAAgC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,gCAAgC,CAAC,8BAA8B,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendSetCookieHeaders.js","sources":["../../../../src/auth/utils/appendSetCookieHeaders.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appendSetCookieHeaders = void 0;\nconst cookie_1 = require(\"../../utils/cookie\");\nconst appendSetCookieHeaders = (headers, cookies, setCookieOptions) => {\n for (const { name, value } of cookies) {\n headers.append('Set-Cookie', (0, cookie_1.serializeCookie)(name, value, setCookieOptions));\n }\n};\nexports.appendSetCookieHeaders = appendSetCookieHeaders;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;AAC9C,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,KAAK;AACvE,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE;AAC3C,QAAQ,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;AAClG;
|
|
1
|
+
{"version":3,"file":"appendSetCookieHeaders.js","sources":["../../../../src/auth/utils/appendSetCookieHeaders.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appendSetCookieHeaders = void 0;\nconst cookie_1 = require(\"../../utils/cookie\");\nconst appendSetCookieHeaders = (headers, cookies, setCookieOptions) => {\n for (const { name, value } of cookies) {\n headers.append('Set-Cookie', (0, cookie_1.serializeCookie)(name, value, setCookieOptions));\n }\n};\nexports.appendSetCookieHeaders = appendSetCookieHeaders;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,sBAAsB,GAAG,MAAM;AACvC,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;AAC9C,MAAM,sBAAsB,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,gBAAgB,KAAK;AACvE,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE;AAC3C,QAAQ,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;AAClG,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,sBAAsB,GAAG,sBAAsB;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appendSetCookieHeadersToNextApiResponse.js","sources":["../../../../src/auth/utils/appendSetCookieHeadersToNextApiResponse.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appendSetCookieHeadersToNextApiResponse = void 0;\nconst cookie_1 = require(\"../../utils/cookie\");\nconst appendSetCookieHeadersToNextApiResponse = (response, cookies, setCookieOptions) => {\n for (const { name, value } of cookies) {\n response.appendHeader('Set-Cookie', (0, cookie_1.serializeCookie)(name, value, setCookieOptions));\n }\n};\nexports.appendSetCookieHeadersToNextApiResponse = appendSetCookieHeadersToNextApiResponse;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;AAC9C,MAAM,uCAAuC,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,KAAK;AACzF,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE;AAC3C,QAAQ,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACzG;
|
|
1
|
+
{"version":3,"file":"appendSetCookieHeadersToNextApiResponse.js","sources":["../../../../src/auth/utils/appendSetCookieHeadersToNextApiResponse.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.appendSetCookieHeadersToNextApiResponse = void 0;\nconst cookie_1 = require(\"../../utils/cookie\");\nconst appendSetCookieHeadersToNextApiResponse = (response, cookies, setCookieOptions) => {\n for (const { name, value } of cookies) {\n response.appendHeader('Set-Cookie', (0, cookie_1.serializeCookie)(name, value, setCookieOptions));\n }\n};\nexports.appendSetCookieHeadersToNextApiResponse = appendSetCookieHeadersToNextApiResponse;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,MAAM;AACxD,MAAM,QAAQ,GAAG,OAAO,CAAC,oBAAoB,CAAC;AAC9C,MAAM,uCAAuC,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,gBAAgB,KAAK;AACzF,IAAI,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,OAAO,EAAE;AAC3C,QAAQ,QAAQ,CAAC,YAAY,CAAC,YAAY,EAAE,IAAI,QAAQ,CAAC,eAAe,EAAE,IAAI,EAAE,KAAK,EAAE,gBAAgB,CAAC,CAAC;AACzG,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,uCAAuC,GAAG,uCAAuC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createErrorSearchParamsString.js","sources":["../../../../src/auth/utils/createErrorSearchParamsString.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createErrorSearchParamsString = void 0;\nconst createErrorSearchParamsString = ({ error, errorDescription, }) => {\n const errorParams = new URLSearchParams();\n if (error) {\n errorParams.set('error', error);\n }\n if (errorDescription) {\n errorParams.set('error_description', errorDescription);\n }\n return errorParams.toString();\n};\nexports.createErrorSearchParamsString = createErrorSearchParamsString;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,MAAM;AAC9C,MAAM,6BAA6B,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,GAAG,KAAK;AACxE,IAAI,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE;AAC7C,IAAI,IAAI,KAAK,EAAE;AACf,QAAQ,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;AACvC;
|
|
1
|
+
{"version":3,"file":"createErrorSearchParamsString.js","sources":["../../../../src/auth/utils/createErrorSearchParamsString.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createErrorSearchParamsString = void 0;\nconst createErrorSearchParamsString = ({ error, errorDescription, }) => {\n const errorParams = new URLSearchParams();\n if (error) {\n errorParams.set('error', error);\n }\n if (errorDescription) {\n errorParams.set('error_description', errorDescription);\n }\n return errorParams.toString();\n};\nexports.createErrorSearchParamsString = createErrorSearchParamsString;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,MAAM;AAC9C,MAAM,6BAA6B,GAAG,CAAC,EAAE,KAAK,EAAE,gBAAgB,GAAG,KAAK;AACxE,IAAI,MAAM,WAAW,GAAG,IAAI,eAAe,EAAE;AAC7C,IAAI,IAAI,KAAK,EAAE;AACf,QAAQ,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC;AACvC,IAAI;AACJ,IAAI,IAAI,gBAAgB,EAAE;AAC1B,QAAQ,WAAW,CAAC,GAAG,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;AAC9D,IAAI;AACJ,IAAI,OAAO,WAAW,CAAC,QAAQ,EAAE;AACjC,CAAC;AACD,OAAO,CAAC,6BAA6B,GAAG,6BAA6B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createUrlSearchParams.js","sources":["../../../../src/auth/utils/createUrlSearchParams.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUrlSearchParamsForTokenRevocation = exports.createUrlSearchParamsForTokenExchange = exports.createUrlSearchParamsForSignInSignUp = void 0;\nconst resolveIdentityProviderFromUrl_1 = require(\"./resolveIdentityProviderFromUrl\");\nconst resolveRedirectUrl_1 = require(\"./resolveRedirectUrl\");\nconst getSearchParamValueFromUrl_1 = require(\"./getSearchParamValueFromUrl\");\nconst createUrlSearchParamsForSignInSignUp = ({ url, oAuthConfig, userPoolClientId, state, origin, codeVerifier, }) => {\n const resolvedProvider = (0, resolveIdentityProviderFromUrl_1.resolveIdentityProviderFromUrl)(url);\n const lang = (0, getSearchParamValueFromUrl_1.getSearchParamValueFromUrl)(url, 'lang');\n const redirectUrlSearchParams = new URLSearchParams({\n redirect_uri: (0, resolveRedirectUrl_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n response_type: oAuthConfig.responseType,\n client_id: userPoolClientId,\n scope: oAuthConfig.scopes.join(' '),\n state,\n code_challenge: codeVerifier.toCodeChallenge(),\n code_challenge_method: codeVerifier.method,\n });\n if (resolvedProvider) {\n redirectUrlSearchParams.append('identity_provider', resolvedProvider);\n }\n if (lang) {\n redirectUrlSearchParams.append('lang', lang);\n }\n return redirectUrlSearchParams;\n};\nexports.createUrlSearchParamsForSignInSignUp = createUrlSearchParamsForSignInSignUp;\nconst createUrlSearchParamsForTokenExchange = (input) => new URLSearchParams(input);\nexports.createUrlSearchParamsForTokenExchange = createUrlSearchParamsForTokenExchange;\nconst createUrlSearchParamsForTokenRevocation = (input) => new URLSearchParams(input);\nexports.createUrlSearchParamsForTokenRevocation = createUrlSearchParamsForTokenRevocation;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,OAAO,CAAC,qCAAqC,GAAG,OAAO,CAAC,oCAAoC,GAAG,MAAM;AACvJ,MAAM,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC;AACpF,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAC5D,MAAM,4BAA4B,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC5E,MAAM,oCAAoC,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK;AACvH,IAAI,MAAM,gBAAgB,GAAG,IAAI,gCAAgC,CAAC,8BAA8B,EAAE,GAAG,CAAC;AACtG,IAAI,MAAM,IAAI,GAAG,IAAI,4BAA4B,CAAC,0BAA0B,EAAE,GAAG,EAAE,MAAM,CAAC;AAC1F,IAAI,MAAM,uBAAuB,GAAG,IAAI,eAAe,CAAC;AACxD,QAAQ,YAAY,EAAE,IAAI,oBAAoB,CAAC,wBAAwB,EAAE,MAAM,EAAE,WAAW,CAAC;AAC7F,QAAQ,aAAa,EAAE,WAAW,CAAC,YAAY;AAC/C,QAAQ,SAAS,EAAE,gBAAgB;AACnC,QAAQ,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3C,QAAQ,KAAK;AACb,QAAQ,cAAc,EAAE,YAAY,CAAC,eAAe,EAAE;AACtD,QAAQ,qBAAqB,EAAE,YAAY,CAAC,MAAM;AAClD,KAAK,CAAC;AACN,IAAI,IAAI,gBAAgB,EAAE;AAC1B,QAAQ,uBAAuB,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;AAC7E;
|
|
1
|
+
{"version":3,"file":"createUrlSearchParams.js","sources":["../../../../src/auth/utils/createUrlSearchParams.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.createUrlSearchParamsForTokenRevocation = exports.createUrlSearchParamsForTokenExchange = exports.createUrlSearchParamsForSignInSignUp = void 0;\nconst resolveIdentityProviderFromUrl_1 = require(\"./resolveIdentityProviderFromUrl\");\nconst resolveRedirectUrl_1 = require(\"./resolveRedirectUrl\");\nconst getSearchParamValueFromUrl_1 = require(\"./getSearchParamValueFromUrl\");\nconst createUrlSearchParamsForSignInSignUp = ({ url, oAuthConfig, userPoolClientId, state, origin, codeVerifier, }) => {\n const resolvedProvider = (0, resolveIdentityProviderFromUrl_1.resolveIdentityProviderFromUrl)(url);\n const lang = (0, getSearchParamValueFromUrl_1.getSearchParamValueFromUrl)(url, 'lang');\n const redirectUrlSearchParams = new URLSearchParams({\n redirect_uri: (0, resolveRedirectUrl_1.resolveRedirectSignInUrl)(origin, oAuthConfig),\n response_type: oAuthConfig.responseType,\n client_id: userPoolClientId,\n scope: oAuthConfig.scopes.join(' '),\n state,\n code_challenge: codeVerifier.toCodeChallenge(),\n code_challenge_method: codeVerifier.method,\n });\n if (resolvedProvider) {\n redirectUrlSearchParams.append('identity_provider', resolvedProvider);\n }\n if (lang) {\n redirectUrlSearchParams.append('lang', lang);\n }\n return redirectUrlSearchParams;\n};\nexports.createUrlSearchParamsForSignInSignUp = createUrlSearchParamsForSignInSignUp;\nconst createUrlSearchParamsForTokenExchange = (input) => new URLSearchParams(input);\nexports.createUrlSearchParamsForTokenExchange = createUrlSearchParamsForTokenExchange;\nconst createUrlSearchParamsForTokenRevocation = (input) => new URLSearchParams(input);\nexports.createUrlSearchParamsForTokenRevocation = createUrlSearchParamsForTokenRevocation;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,uCAAuC,GAAG,OAAO,CAAC,qCAAqC,GAAG,OAAO,CAAC,oCAAoC,GAAG,MAAM;AACvJ,MAAM,gCAAgC,GAAG,OAAO,CAAC,kCAAkC,CAAC;AACpF,MAAM,oBAAoB,GAAG,OAAO,CAAC,sBAAsB,CAAC;AAC5D,MAAM,4BAA4B,GAAG,OAAO,CAAC,8BAA8B,CAAC;AAC5E,MAAM,oCAAoC,GAAG,CAAC,EAAE,GAAG,EAAE,WAAW,EAAE,gBAAgB,EAAE,KAAK,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK;AACvH,IAAI,MAAM,gBAAgB,GAAG,IAAI,gCAAgC,CAAC,8BAA8B,EAAE,GAAG,CAAC;AACtG,IAAI,MAAM,IAAI,GAAG,IAAI,4BAA4B,CAAC,0BAA0B,EAAE,GAAG,EAAE,MAAM,CAAC;AAC1F,IAAI,MAAM,uBAAuB,GAAG,IAAI,eAAe,CAAC;AACxD,QAAQ,YAAY,EAAE,IAAI,oBAAoB,CAAC,wBAAwB,EAAE,MAAM,EAAE,WAAW,CAAC;AAC7F,QAAQ,aAAa,EAAE,WAAW,CAAC,YAAY;AAC/C,QAAQ,SAAS,EAAE,gBAAgB;AACnC,QAAQ,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3C,QAAQ,KAAK;AACb,QAAQ,cAAc,EAAE,YAAY,CAAC,eAAe,EAAE;AACtD,QAAQ,qBAAqB,EAAE,YAAY,CAAC,MAAM;AAClD,KAAK,CAAC;AACN,IAAI,IAAI,gBAAgB,EAAE;AAC1B,QAAQ,uBAAuB,CAAC,MAAM,CAAC,mBAAmB,EAAE,gBAAgB,CAAC;AAC7E,IAAI;AACJ,IAAI,IAAI,IAAI,EAAE;AACd,QAAQ,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,CAAC;AACpD,IAAI;AACJ,IAAI,OAAO,uBAAuB;AAClC,CAAC;AACD,OAAO,CAAC,oCAAoC,GAAG,oCAAoC;AACnF,MAAM,qCAAqC,GAAG,CAAC,KAAK,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC;AACnF,OAAO,CAAC,qCAAqC,GAAG,qCAAqC;AACrF,MAAM,uCAAuC,GAAG,CAAC,KAAK,KAAK,IAAI,eAAe,CAAC,KAAK,CAAC;AACrF,OAAO,CAAC,uCAAuC,GAAG,uCAAuC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCookieValuesFromNextApiRequest.js","sources":["../../../../src/auth/utils/getCookieValuesFromNextApiRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCookieValuesFromNextApiRequest = void 0;\nconst getCookieValuesFromNextApiRequest = (request, cookieNames) => {\n const result = {};\n for (const cookieName of cookieNames) {\n result[cookieName] = request.cookies[cookieName];\n }\n return result;\n};\nexports.getCookieValuesFromNextApiRequest = getCookieValuesFromNextApiRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAClD,MAAM,iCAAiC,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK;AACpE,IAAI,MAAM,MAAM,GAAG,EAAE;AACrB,IAAI,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AAC1C,QAAQ,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AACxD;
|
|
1
|
+
{"version":3,"file":"getCookieValuesFromNextApiRequest.js","sources":["../../../../src/auth/utils/getCookieValuesFromNextApiRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCookieValuesFromNextApiRequest = void 0;\nconst getCookieValuesFromNextApiRequest = (request, cookieNames) => {\n const result = {};\n for (const cookieName of cookieNames) {\n result[cookieName] = request.cookies[cookieName];\n }\n return result;\n};\nexports.getCookieValuesFromNextApiRequest = getCookieValuesFromNextApiRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAClD,MAAM,iCAAiC,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK;AACpE,IAAI,MAAM,MAAM,GAAG,EAAE;AACrB,IAAI,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AAC1C,QAAQ,MAAM,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;AACxD,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB,CAAC;AACD,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getCookieValuesFromRequest.js","sources":["../../../../src/auth/utils/getCookieValuesFromRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCookieValuesFromRequest = void 0;\nconst getCookieValuesFromRequest = (request, cookieNames) => {\n const cookieHeader = request.headers.get('Cookie');\n if (!cookieHeader) {\n return {};\n }\n const cookieValues = cookieHeader\n .split(';')\n .map(cookie => cookie.trim().split('='))\n .reduce((result, [key, value]) => {\n result[key] = value;\n return result;\n }, {});\n const result = {};\n for (const cookieName of cookieNames) {\n result[cookieName] = cookieValues[cookieName];\n }\n return result;\n};\nexports.getCookieValuesFromRequest = getCookieValuesFromRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAC3C,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK;AAC7D,IAAI,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AACtD,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,EAAE;AACjB;
|
|
1
|
+
{"version":3,"file":"getCookieValuesFromRequest.js","sources":["../../../../src/auth/utils/getCookieValuesFromRequest.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getCookieValuesFromRequest = void 0;\nconst getCookieValuesFromRequest = (request, cookieNames) => {\n const cookieHeader = request.headers.get('Cookie');\n if (!cookieHeader) {\n return {};\n }\n const cookieValues = cookieHeader\n .split(';')\n .map(cookie => cookie.trim().split('='))\n .reduce((result, [key, value]) => {\n result[key] = value;\n return result;\n }, {});\n const result = {};\n for (const cookieName of cookieNames) {\n result[cookieName] = cookieValues[cookieName];\n }\n return result;\n};\nexports.getCookieValuesFromRequest = getCookieValuesFromRequest;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAC3C,MAAM,0BAA0B,GAAG,CAAC,OAAO,EAAE,WAAW,KAAK;AAC7D,IAAI,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;AACtD,IAAI,IAAI,CAAC,YAAY,EAAE;AACvB,QAAQ,OAAO,EAAE;AACjB,IAAI;AACJ,IAAI,MAAM,YAAY,GAAG;AACzB,SAAS,KAAK,CAAC,GAAG;AAClB,SAAS,GAAG,CAAC,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC;AAC/C,SAAS,MAAM,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK;AAC1C,QAAQ,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK;AAC3B,QAAQ,OAAO,MAAM;AACrB,IAAI,CAAC,EAAE,EAAE,CAAC;AACV,IAAI,MAAM,MAAM,GAAG,EAAE;AACrB,IAAI,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE;AAC1C,QAAQ,MAAM,CAAC,UAAU,CAAC,GAAG,YAAY,CAAC,UAAU,CAAC;AACrD,IAAI;AACJ,IAAI,OAAO,MAAM;AACjB,CAAC;AACD,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getSearchParamValueFromUrl.js","sources":["../../../../src/auth/utils/getSearchParamValueFromUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getSearchParamValueFromUrl = void 0;\nconst getSearchParamValueFromUrl = (urlStr, paramName) => {\n if (urlStr.includes('?')) {\n const queryParams = urlStr.split('?')[1];\n if (queryParams) {\n return new URLSearchParams(queryParams).get(paramName);\n }\n }\n return null;\n};\nexports.getSearchParamValueFromUrl = getSearchParamValueFromUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAC3C,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK;AAC1D,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC9B,QAAQ,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChD,QAAQ,IAAI,WAAW,EAAE;AACzB,YAAY,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;AAClE;
|
|
1
|
+
{"version":3,"file":"getSearchParamValueFromUrl.js","sources":["../../../../src/auth/utils/getSearchParamValueFromUrl.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getSearchParamValueFromUrl = void 0;\nconst getSearchParamValueFromUrl = (urlStr, paramName) => {\n if (urlStr.includes('?')) {\n const queryParams = urlStr.split('?')[1];\n if (queryParams) {\n return new URLSearchParams(queryParams).get(paramName);\n }\n }\n return null;\n};\nexports.getSearchParamValueFromUrl = getSearchParamValueFromUrl;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,0BAA0B,GAAG,MAAM;AAC3C,MAAM,0BAA0B,GAAG,CAAC,MAAM,EAAE,SAAS,KAAK;AAC1D,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAC9B,QAAQ,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAChD,QAAQ,IAAI,WAAW,EAAE;AACzB,YAAY,OAAO,IAAI,eAAe,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC;AAClE,QAAQ;AACR,IAAI;AACJ,IAAI,OAAO,IAAI;AACf,CAAC;AACD,OAAO,CAAC,0BAA0B,GAAG,0BAA0B;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hasActiveUserSession.js","sources":["../../../../src/auth/utils/hasActiveUserSession.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasActiveUserSessionWithPagesRouter = exports.hasActiveUserSessionWithAppRouter = void 0;\nconst server_1 = require(\"aws-amplify/auth/server\");\nconst hasActiveUserSessionWithAppRouter = async ({ request, runWithAmplifyServerContext, }) => {\n const dummyResponse = new Response();\n try {\n await runWithAmplifyServerContext({\n nextServerContext: { request, response: dummyResponse },\n operation(contextSpec) {\n return (0, server_1.getCurrentUser)(contextSpec);\n },\n });\n return true;\n }\n catch (_) {\n // `getCurrentUser()` throws if there is no valid token\n return false;\n }\n};\nexports.hasActiveUserSessionWithAppRouter = hasActiveUserSessionWithAppRouter;\nconst hasActiveUserSessionWithPagesRouter = async ({ request, response, runWithAmplifyServerContext, }) => {\n try {\n await runWithAmplifyServerContext({\n nextServerContext: { request, response },\n operation(contextSpec) {\n return (0, server_1.getCurrentUser)(contextSpec);\n },\n });\n return true;\n }\n catch (_) {\n // `getCurrentUser()` throws if there is no valid token\n return false;\n }\n};\nexports.hasActiveUserSessionWithPagesRouter = hasActiveUserSessionWithPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mCAAmC,GAAG,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAChG,MAAM,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC;AACnD,MAAM,iCAAiC,GAAG,OAAO,EAAE,OAAO,EAAE,2BAA2B,GAAG,KAAK;AAC/F,IAAI,MAAM,aAAa,GAAG,IAAI,QAAQ,EAAE;AACxC,IAAI,IAAI;AACR,QAAQ,MAAM,2BAA2B,CAAC;AAC1C,YAAY,iBAAiB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE;AACnE,YAAY,SAAS,CAAC,WAAW,EAAE;AACnC,gBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;AAChE,
|
|
1
|
+
{"version":3,"file":"hasActiveUserSession.js","sources":["../../../../src/auth/utils/hasActiveUserSession.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.hasActiveUserSessionWithPagesRouter = exports.hasActiveUserSessionWithAppRouter = void 0;\nconst server_1 = require(\"aws-amplify/auth/server\");\nconst hasActiveUserSessionWithAppRouter = async ({ request, runWithAmplifyServerContext, }) => {\n const dummyResponse = new Response();\n try {\n await runWithAmplifyServerContext({\n nextServerContext: { request, response: dummyResponse },\n operation(contextSpec) {\n return (0, server_1.getCurrentUser)(contextSpec);\n },\n });\n return true;\n }\n catch (_) {\n // `getCurrentUser()` throws if there is no valid token\n return false;\n }\n};\nexports.hasActiveUserSessionWithAppRouter = hasActiveUserSessionWithAppRouter;\nconst hasActiveUserSessionWithPagesRouter = async ({ request, response, runWithAmplifyServerContext, }) => {\n try {\n await runWithAmplifyServerContext({\n nextServerContext: { request, response },\n operation(contextSpec) {\n return (0, server_1.getCurrentUser)(contextSpec);\n },\n });\n return true;\n }\n catch (_) {\n // `getCurrentUser()` throws if there is no valid token\n return false;\n }\n};\nexports.hasActiveUserSessionWithPagesRouter = hasActiveUserSessionWithPagesRouter;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,mCAAmC,GAAG,OAAO,CAAC,iCAAiC,GAAG,MAAM;AAChG,MAAM,QAAQ,GAAG,OAAO,CAAC,yBAAyB,CAAC;AACnD,MAAM,iCAAiC,GAAG,OAAO,EAAE,OAAO,EAAE,2BAA2B,GAAG,KAAK;AAC/F,IAAI,MAAM,aAAa,GAAG,IAAI,QAAQ,EAAE;AACxC,IAAI,IAAI;AACR,QAAQ,MAAM,2BAA2B,CAAC;AAC1C,YAAY,iBAAiB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE;AACnE,YAAY,SAAS,CAAC,WAAW,EAAE;AACnC,gBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;AAChE,YAAY,CAAC;AACb,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,iCAAiC,GAAG,iCAAiC;AAC7E,MAAM,mCAAmC,GAAG,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,2BAA2B,GAAG,KAAK;AAC3G,IAAI,IAAI;AACR,QAAQ,MAAM,2BAA2B,CAAC;AAC1C,YAAY,iBAAiB,EAAE,EAAE,OAAO,EAAE,QAAQ,EAAE;AACpD,YAAY,SAAS,CAAC,WAAW,EAAE;AACnC,gBAAgB,OAAO,CAAC,CAAC,EAAE,QAAQ,CAAC,cAAc,EAAE,WAAW,CAAC;AAChE,YAAY,CAAC;AACb,SAAS,CAAC;AACV,QAAQ,OAAO,IAAI;AACnB,IAAI;AACJ,IAAI,OAAO,CAAC,EAAE;AACd;AACA,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,CAAC;AACD,OAAO,CAAC,mCAAmC,GAAG,mCAAmC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../src/auth/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isServerSideAuthAllowedCookie = exports.createTokenCookiesRemoveOptions = exports.createTokenCookiesSetOptions = exports.createTokenRemoveCookies = exports.createTokenCookies = exports.resolveRedirectSignOutUrl = exports.resolveRedirectSignInUrl = exports.resolveIdentityProviderFromUrl = exports.parseSignInCallbackUrl = exports.isSSLOrigin = exports.isValidOrigin = exports.isSupportedAuthApiRoutePath = exports.hasActiveUserSessionWithPagesRouter = exports.hasActiveUserSessionWithAppRouter = exports.isNextRequest = exports.isNextApiResponse = exports.isNextApiRequest = exports.isAuthRoutesHandlersContext = exports.getRedirectOrDefault = exports.getCookieValuesFromRequest = exports.getCookieValuesFromNextApiRequest = exports.getAccessTokenUsername = exports.createRevokeEndpoint = exports.createTokenEndpoint = exports.createLogoutEndpoint = exports.createSignUpEndpoint = exports.createAuthorizeEndpoint = exports.createUrlSearchParamsForSignInSignUp = exports.createRedirectionIntermediary = exports.createErrorSearchParamsString = exports.createAuthFlowProofs = exports.createAuthFlowProofCookiesRemoveOptions = exports.createAuthFlowProofCookiesSetOptions = exports.createSignOutFlowProofCookies = exports.createSignInFlowProofCookies = exports.appendSetCookieHeadersToNextApiResponse = exports.revokeAuthNTokens = exports.exchangeAuthNTokens = exports.appendSetCookieHeaders = void 0;\nvar appendSetCookieHeaders_1 = require(\"./appendSetCookieHeaders\");\nObject.defineProperty(exports, \"appendSetCookieHeaders\", { enumerable: true, get: function () { return appendSetCookieHeaders_1.appendSetCookieHeaders; } });\nvar authNTokens_1 = require(\"./authNTokens\");\nObject.defineProperty(exports, \"exchangeAuthNTokens\", { enumerable: true, get: function () { return authNTokens_1.exchangeAuthNTokens; } });\nObject.defineProperty(exports, \"revokeAuthNTokens\", { enumerable: true, get: function () { return authNTokens_1.revokeAuthNTokens; } });\nvar appendSetCookieHeadersToNextApiResponse_1 = require(\"./appendSetCookieHeadersToNextApiResponse\");\nObject.defineProperty(exports, \"appendSetCookieHeadersToNextApiResponse\", { enumerable: true, get: function () { return appendSetCookieHeadersToNextApiResponse_1.appendSetCookieHeadersToNextApiResponse; } });\nvar authFlowProofCookies_1 = require(\"./authFlowProofCookies\");\nObject.defineProperty(exports, \"createSignInFlowProofCookies\", { enumerable: true, get: function () { return authFlowProofCookies_1.createSignInFlowProofCookies; } });\nObject.defineProperty(exports, \"createSignOutFlowProofCookies\", { enumerable: true, get: function () { return authFlowProofCookies_1.createSignOutFlowProofCookies; } });\nObject.defineProperty(exports, \"createAuthFlowProofCookiesSetOptions\", { enumerable: true, get: function () { return authFlowProofCookies_1.createAuthFlowProofCookiesSetOptions; } });\nObject.defineProperty(exports, \"createAuthFlowProofCookiesRemoveOptions\", { enumerable: true, get: function () { return authFlowProofCookies_1.createAuthFlowProofCookiesRemoveOptions; } });\nvar createAuthFlowProofs_1 = require(\"./createAuthFlowProofs\");\nObject.defineProperty(exports, \"createAuthFlowProofs\", { enumerable: true, get: function () { return createAuthFlowProofs_1.createAuthFlowProofs; } });\nvar createErrorSearchParamsString_1 = require(\"./createErrorSearchParamsString\");\nObject.defineProperty(exports, \"createErrorSearchParamsString\", { enumerable: true, get: function () { return createErrorSearchParamsString_1.createErrorSearchParamsString; } });\nvar createRedirectionIntermediary_1 = require(\"./createRedirectionIntermediary\");\nObject.defineProperty(exports, \"createRedirectionIntermediary\", { enumerable: true, get: function () { return createRedirectionIntermediary_1.createRedirectionIntermediary; } });\nvar createUrlSearchParams_1 = require(\"./createUrlSearchParams\");\nObject.defineProperty(exports, \"createUrlSearchParamsForSignInSignUp\", { enumerable: true, get: function () { return createUrlSearchParams_1.createUrlSearchParamsForSignInSignUp; } });\nvar cognitoHostedUIEndpoints_1 = require(\"./cognitoHostedUIEndpoints\");\nObject.defineProperty(exports, \"createAuthorizeEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createAuthorizeEndpoint; } });\nObject.defineProperty(exports, \"createSignUpEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createSignUpEndpoint; } });\nObject.defineProperty(exports, \"createLogoutEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createLogoutEndpoint; } });\nObject.defineProperty(exports, \"createTokenEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createTokenEndpoint; } });\nObject.defineProperty(exports, \"createRevokeEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createRevokeEndpoint; } });\nvar getAccessTokenUsername_1 = require(\"./getAccessTokenUsername\");\nObject.defineProperty(exports, \"getAccessTokenUsername\", { enumerable: true, get: function () { return getAccessTokenUsername_1.getAccessTokenUsername; } });\nvar getCookieValuesFromNextApiRequest_1 = require(\"./getCookieValuesFromNextApiRequest\");\nObject.defineProperty(exports, \"getCookieValuesFromNextApiRequest\", { enumerable: true, get: function () { return getCookieValuesFromNextApiRequest_1.getCookieValuesFromNextApiRequest; } });\nvar getCookieValuesFromRequest_1 = require(\"./getCookieValuesFromRequest\");\nObject.defineProperty(exports, \"getCookieValuesFromRequest\", { enumerable: true, get: function () { return getCookieValuesFromRequest_1.getCookieValuesFromRequest; } });\nvar getRedirectOrDefault_1 = require(\"./getRedirectOrDefault\");\nObject.defineProperty(exports, \"getRedirectOrDefault\", { enumerable: true, get: function () { return getRedirectOrDefault_1.getRedirectOrDefault; } });\nvar predicates_1 = require(\"./predicates\");\nObject.defineProperty(exports, \"isAuthRoutesHandlersContext\", { enumerable: true, get: function () { return predicates_1.isAuthRoutesHandlersContext; } });\nObject.defineProperty(exports, \"isNextApiRequest\", { enumerable: true, get: function () { return predicates_1.isNextApiRequest; } });\nObject.defineProperty(exports, \"isNextApiResponse\", { enumerable: true, get: function () { return predicates_1.isNextApiResponse; } });\nObject.defineProperty(exports, \"isNextRequest\", { enumerable: true, get: function () { return predicates_1.isNextRequest; } });\nvar hasActiveUserSession_1 = require(\"./hasActiveUserSession\");\nObject.defineProperty(exports, \"hasActiveUserSessionWithAppRouter\", { enumerable: true, get: function () { return hasActiveUserSession_1.hasActiveUserSessionWithAppRouter; } });\nObject.defineProperty(exports, \"hasActiveUserSessionWithPagesRouter\", { enumerable: true, get: function () { return hasActiveUserSession_1.hasActiveUserSessionWithPagesRouter; } });\nvar isSupportedAuthApiRoutePath_1 = require(\"./isSupportedAuthApiRoutePath\");\nObject.defineProperty(exports, \"isSupportedAuthApiRoutePath\", { enumerable: true, get: function () { return isSupportedAuthApiRoutePath_1.isSupportedAuthApiRoutePath; } });\nvar origin_1 = require(\"./origin\");\nObject.defineProperty(exports, \"isValidOrigin\", { enumerable: true, get: function () { return origin_1.isValidOrigin; } });\nObject.defineProperty(exports, \"isSSLOrigin\", { enumerable: true, get: function () { return origin_1.isSSLOrigin; } });\nvar parseSignInCallbackUrl_1 = require(\"./parseSignInCallbackUrl\");\nObject.defineProperty(exports, \"parseSignInCallbackUrl\", { enumerable: true, get: function () { return parseSignInCallbackUrl_1.parseSignInCallbackUrl; } });\nvar resolveIdentityProviderFromUrl_1 = require(\"./resolveIdentityProviderFromUrl\");\nObject.defineProperty(exports, \"resolveIdentityProviderFromUrl\", { enumerable: true, get: function () { return resolveIdentityProviderFromUrl_1.resolveIdentityProviderFromUrl; } });\nvar resolveRedirectUrl_1 = require(\"./resolveRedirectUrl\");\nObject.defineProperty(exports, \"resolveRedirectSignInUrl\", { enumerable: true, get: function () { return resolveRedirectUrl_1.resolveRedirectSignInUrl; } });\nObject.defineProperty(exports, \"resolveRedirectSignOutUrl\", { enumerable: true, get: function () { return resolveRedirectUrl_1.resolveRedirectSignOutUrl; } });\nvar tokenCookies_1 = require(\"./tokenCookies\");\nObject.defineProperty(exports, \"createTokenCookies\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookies; } });\nObject.defineProperty(exports, \"createTokenRemoveCookies\", { enumerable: true, get: function () { return tokenCookies_1.createTokenRemoveCookies; } });\nObject.defineProperty(exports, \"createTokenCookiesSetOptions\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookiesSetOptions; } });\nObject.defineProperty(exports, \"createTokenCookiesRemoveOptions\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookiesRemoveOptions; } });\nObject.defineProperty(exports, \"isServerSideAuthAllowedCookie\", { enumerable: true, get: function () { return tokenCookies_1.isServerSideAuthAllowedCookie; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,8BAA8B,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,2BAA2B,GAAG,OAAO,CAAC,mCAAmC,GAAG,OAAO,CAAC,iCAAiC,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,GAAG,OAAO,CAAC,2BAA2B,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,iCAAiC,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,oBAAoB,GAAG,OAAO,CAAC,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,EAAE,CAAC;AACtJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,4BAA4B,CAAC,EAAE,EAAE,CAAC;AAC9J,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iCAAiC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,+BAA+B,CAAC,EAAE,EAAE,CAAC;AACpK,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,+BAA+B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,6BAA6B,CAAC,EAAE,EAAE,CAAC;;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../src/auth/utils/index.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isServerSideAuthAllowedCookie = exports.createTokenCookiesRemoveOptions = exports.createTokenCookiesSetOptions = exports.createTokenRemoveCookies = exports.createTokenCookies = exports.resolveRedirectSignOutUrl = exports.resolveRedirectSignInUrl = exports.resolveIdentityProviderFromUrl = exports.parseSignInCallbackUrl = exports.isSSLOrigin = exports.isValidOrigin = exports.isSupportedAuthApiRoutePath = exports.hasActiveUserSessionWithPagesRouter = exports.hasActiveUserSessionWithAppRouter = exports.isNextRequest = exports.isNextApiResponse = exports.isNextApiRequest = exports.isAuthRoutesHandlersContext = exports.getRedirectOrDefault = exports.getCookieValuesFromRequest = exports.getCookieValuesFromNextApiRequest = exports.getAccessTokenUsername = exports.createRevokeEndpoint = exports.createTokenEndpoint = exports.createLogoutEndpoint = exports.createSignUpEndpoint = exports.createAuthorizeEndpoint = exports.createUrlSearchParamsForSignInSignUp = exports.createRedirectionIntermediary = exports.createErrorSearchParamsString = exports.createAuthFlowProofs = exports.createAuthFlowProofCookiesRemoveOptions = exports.createAuthFlowProofCookiesSetOptions = exports.createSignOutFlowProofCookies = exports.createSignInFlowProofCookies = exports.appendSetCookieHeadersToNextApiResponse = exports.revokeAuthNTokens = exports.exchangeAuthNTokens = exports.appendSetCookieHeaders = void 0;\nvar appendSetCookieHeaders_1 = require(\"./appendSetCookieHeaders\");\nObject.defineProperty(exports, \"appendSetCookieHeaders\", { enumerable: true, get: function () { return appendSetCookieHeaders_1.appendSetCookieHeaders; } });\nvar authNTokens_1 = require(\"./authNTokens\");\nObject.defineProperty(exports, \"exchangeAuthNTokens\", { enumerable: true, get: function () { return authNTokens_1.exchangeAuthNTokens; } });\nObject.defineProperty(exports, \"revokeAuthNTokens\", { enumerable: true, get: function () { return authNTokens_1.revokeAuthNTokens; } });\nvar appendSetCookieHeadersToNextApiResponse_1 = require(\"./appendSetCookieHeadersToNextApiResponse\");\nObject.defineProperty(exports, \"appendSetCookieHeadersToNextApiResponse\", { enumerable: true, get: function () { return appendSetCookieHeadersToNextApiResponse_1.appendSetCookieHeadersToNextApiResponse; } });\nvar authFlowProofCookies_1 = require(\"./authFlowProofCookies\");\nObject.defineProperty(exports, \"createSignInFlowProofCookies\", { enumerable: true, get: function () { return authFlowProofCookies_1.createSignInFlowProofCookies; } });\nObject.defineProperty(exports, \"createSignOutFlowProofCookies\", { enumerable: true, get: function () { return authFlowProofCookies_1.createSignOutFlowProofCookies; } });\nObject.defineProperty(exports, \"createAuthFlowProofCookiesSetOptions\", { enumerable: true, get: function () { return authFlowProofCookies_1.createAuthFlowProofCookiesSetOptions; } });\nObject.defineProperty(exports, \"createAuthFlowProofCookiesRemoveOptions\", { enumerable: true, get: function () { return authFlowProofCookies_1.createAuthFlowProofCookiesRemoveOptions; } });\nvar createAuthFlowProofs_1 = require(\"./createAuthFlowProofs\");\nObject.defineProperty(exports, \"createAuthFlowProofs\", { enumerable: true, get: function () { return createAuthFlowProofs_1.createAuthFlowProofs; } });\nvar createErrorSearchParamsString_1 = require(\"./createErrorSearchParamsString\");\nObject.defineProperty(exports, \"createErrorSearchParamsString\", { enumerable: true, get: function () { return createErrorSearchParamsString_1.createErrorSearchParamsString; } });\nvar createRedirectionIntermediary_1 = require(\"./createRedirectionIntermediary\");\nObject.defineProperty(exports, \"createRedirectionIntermediary\", { enumerable: true, get: function () { return createRedirectionIntermediary_1.createRedirectionIntermediary; } });\nvar createUrlSearchParams_1 = require(\"./createUrlSearchParams\");\nObject.defineProperty(exports, \"createUrlSearchParamsForSignInSignUp\", { enumerable: true, get: function () { return createUrlSearchParams_1.createUrlSearchParamsForSignInSignUp; } });\nvar cognitoHostedUIEndpoints_1 = require(\"./cognitoHostedUIEndpoints\");\nObject.defineProperty(exports, \"createAuthorizeEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createAuthorizeEndpoint; } });\nObject.defineProperty(exports, \"createSignUpEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createSignUpEndpoint; } });\nObject.defineProperty(exports, \"createLogoutEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createLogoutEndpoint; } });\nObject.defineProperty(exports, \"createTokenEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createTokenEndpoint; } });\nObject.defineProperty(exports, \"createRevokeEndpoint\", { enumerable: true, get: function () { return cognitoHostedUIEndpoints_1.createRevokeEndpoint; } });\nvar getAccessTokenUsername_1 = require(\"./getAccessTokenUsername\");\nObject.defineProperty(exports, \"getAccessTokenUsername\", { enumerable: true, get: function () { return getAccessTokenUsername_1.getAccessTokenUsername; } });\nvar getCookieValuesFromNextApiRequest_1 = require(\"./getCookieValuesFromNextApiRequest\");\nObject.defineProperty(exports, \"getCookieValuesFromNextApiRequest\", { enumerable: true, get: function () { return getCookieValuesFromNextApiRequest_1.getCookieValuesFromNextApiRequest; } });\nvar getCookieValuesFromRequest_1 = require(\"./getCookieValuesFromRequest\");\nObject.defineProperty(exports, \"getCookieValuesFromRequest\", { enumerable: true, get: function () { return getCookieValuesFromRequest_1.getCookieValuesFromRequest; } });\nvar getRedirectOrDefault_1 = require(\"./getRedirectOrDefault\");\nObject.defineProperty(exports, \"getRedirectOrDefault\", { enumerable: true, get: function () { return getRedirectOrDefault_1.getRedirectOrDefault; } });\nvar predicates_1 = require(\"./predicates\");\nObject.defineProperty(exports, \"isAuthRoutesHandlersContext\", { enumerable: true, get: function () { return predicates_1.isAuthRoutesHandlersContext; } });\nObject.defineProperty(exports, \"isNextApiRequest\", { enumerable: true, get: function () { return predicates_1.isNextApiRequest; } });\nObject.defineProperty(exports, \"isNextApiResponse\", { enumerable: true, get: function () { return predicates_1.isNextApiResponse; } });\nObject.defineProperty(exports, \"isNextRequest\", { enumerable: true, get: function () { return predicates_1.isNextRequest; } });\nvar hasActiveUserSession_1 = require(\"./hasActiveUserSession\");\nObject.defineProperty(exports, \"hasActiveUserSessionWithAppRouter\", { enumerable: true, get: function () { return hasActiveUserSession_1.hasActiveUserSessionWithAppRouter; } });\nObject.defineProperty(exports, \"hasActiveUserSessionWithPagesRouter\", { enumerable: true, get: function () { return hasActiveUserSession_1.hasActiveUserSessionWithPagesRouter; } });\nvar isSupportedAuthApiRoutePath_1 = require(\"./isSupportedAuthApiRoutePath\");\nObject.defineProperty(exports, \"isSupportedAuthApiRoutePath\", { enumerable: true, get: function () { return isSupportedAuthApiRoutePath_1.isSupportedAuthApiRoutePath; } });\nvar origin_1 = require(\"./origin\");\nObject.defineProperty(exports, \"isValidOrigin\", { enumerable: true, get: function () { return origin_1.isValidOrigin; } });\nObject.defineProperty(exports, \"isSSLOrigin\", { enumerable: true, get: function () { return origin_1.isSSLOrigin; } });\nvar parseSignInCallbackUrl_1 = require(\"./parseSignInCallbackUrl\");\nObject.defineProperty(exports, \"parseSignInCallbackUrl\", { enumerable: true, get: function () { return parseSignInCallbackUrl_1.parseSignInCallbackUrl; } });\nvar resolveIdentityProviderFromUrl_1 = require(\"./resolveIdentityProviderFromUrl\");\nObject.defineProperty(exports, \"resolveIdentityProviderFromUrl\", { enumerable: true, get: function () { return resolveIdentityProviderFromUrl_1.resolveIdentityProviderFromUrl; } });\nvar resolveRedirectUrl_1 = require(\"./resolveRedirectUrl\");\nObject.defineProperty(exports, \"resolveRedirectSignInUrl\", { enumerable: true, get: function () { return resolveRedirectUrl_1.resolveRedirectSignInUrl; } });\nObject.defineProperty(exports, \"resolveRedirectSignOutUrl\", { enumerable: true, get: function () { return resolveRedirectUrl_1.resolveRedirectSignOutUrl; } });\nvar tokenCookies_1 = require(\"./tokenCookies\");\nObject.defineProperty(exports, \"createTokenCookies\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookies; } });\nObject.defineProperty(exports, \"createTokenRemoveCookies\", { enumerable: true, get: function () { return tokenCookies_1.createTokenRemoveCookies; } });\nObject.defineProperty(exports, \"createTokenCookiesSetOptions\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookiesSetOptions; } });\nObject.defineProperty(exports, \"createTokenCookiesRemoveOptions\", { enumerable: true, get: function () { return tokenCookies_1.createTokenCookiesRemoveOptions; } });\nObject.defineProperty(exports, \"isServerSideAuthAllowedCookie\", { enumerable: true, get: function () { return tokenCookies_1.isServerSideAuthAllowedCookie; } });\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,6BAA6B,GAAG,OAAO,CAAC,+BAA+B,GAAG,OAAO,CAAC,4BAA4B,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,kBAAkB,GAAG,OAAO,CAAC,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,GAAG,OAAO,CAAC,8BAA8B,GAAG,OAAO,CAAC,sBAAsB,GAAG,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,OAAO,CAAC,2BAA2B,GA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CAAC,OAAO,EAAE,2BAA2B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,oBAAoB,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9J,IAAI,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;AAC9C,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,oBAAoB,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;AAC1I,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,0BAA0B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,wBAAwB,CAAC,CAAC,CAAC,EAAE,CAAC;AACtJ,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,8BAA8B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,CAAC;AAC9J,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,iCAAiC,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,+BAA+B,CAAC,CAAC,CAAC,EAAE,CAAC;AACpK,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,+BAA+B,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,OAAO,cAAc,CAAC,6BAA6B,CAAC,CAAC,CAAC,EAAE,CAAC;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"origin.js","sources":["../../../../src/auth/utils/origin.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSSLOrigin = exports.isValidOrigin = void 0;\n// a regular expression that validates the origin string to be any valid origin, and allowing local development localhost\nconst originRegex = /^(http:\\/\\/localhost(:\\d{1,5})?)|(https?:\\/\\/[a-z0-9-]+(\\.[a-z0-9-]+)*(:\\d{1,5})?)$/;\nconst isValidOrigin = (origin) => {\n const url = createUrlObjectOrUndefined(origin);\n if (!url) {\n return false;\n }\n if (url.protocol === 'http:' &&\n url.hostname !== 'localhost' &&\n url.hostname !== '127.0.0.1') {\n // eslint-disable-next-line no-console\n console.warn('HTTP origin detected. This is insecure and should only be used for local development.');\n }\n return url.protocol === 'http:' || url.protocol === 'https:';\n};\nexports.isValidOrigin = isValidOrigin;\nconst isSSLOrigin = (origin) => {\n const url = createUrlObjectOrUndefined(origin);\n if (!url) {\n return false;\n }\n return url.protocol === 'https:';\n};\nexports.isSSLOrigin = isSSLOrigin;\nconst createUrlObjectOrUndefined = (url) => {\n if (!url) {\n return undefined;\n }\n // we don't allow format such as `https://localhost:` (without the port number) which is valid in URL constructor\n if (!originRegex.test(url)) {\n return undefined;\n }\n // the `originRegex` ensured a string that can be parsed by URL constructor\n return new URL(url);\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AACpD;AACA,MAAM,WAAW,GAAG,qFAAqF;AACzG,MAAM,aAAa,GAAG,CAAC,MAAM,KAAK;AAClC,IAAI,MAAM,GAAG,GAAG,0BAA0B,CAAC,MAAM,CAAC;AAClD,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,QAAQ,OAAO,KAAK;AACpB;
|
|
1
|
+
{"version":3,"file":"origin.js","sources":["../../../../src/auth/utils/origin.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isSSLOrigin = exports.isValidOrigin = void 0;\n// a regular expression that validates the origin string to be any valid origin, and allowing local development localhost\nconst originRegex = /^(http:\\/\\/localhost(:\\d{1,5})?)|(https?:\\/\\/[a-z0-9-]+(\\.[a-z0-9-]+)*(:\\d{1,5})?)$/;\nconst isValidOrigin = (origin) => {\n const url = createUrlObjectOrUndefined(origin);\n if (!url) {\n return false;\n }\n if (url.protocol === 'http:' &&\n url.hostname !== 'localhost' &&\n url.hostname !== '127.0.0.1') {\n // eslint-disable-next-line no-console\n console.warn('HTTP origin detected. This is insecure and should only be used for local development.');\n }\n return url.protocol === 'http:' || url.protocol === 'https:';\n};\nexports.isValidOrigin = isValidOrigin;\nconst isSSLOrigin = (origin) => {\n const url = createUrlObjectOrUndefined(origin);\n if (!url) {\n return false;\n }\n return url.protocol === 'https:';\n};\nexports.isSSLOrigin = isSSLOrigin;\nconst createUrlObjectOrUndefined = (url) => {\n if (!url) {\n return undefined;\n }\n // we don't allow format such as `https://localhost:` (without the port number) which is valid in URL constructor\n if (!originRegex.test(url)) {\n return undefined;\n }\n // the `originRegex` ensured a string that can be parsed by URL constructor\n return new URL(url);\n};\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,WAAW,GAAG,OAAO,CAAC,aAAa,GAAG,MAAM;AACpD;AACA,MAAM,WAAW,GAAG,qFAAqF;AACzG,MAAM,aAAa,GAAG,CAAC,MAAM,KAAK;AAClC,IAAI,MAAM,GAAG,GAAG,0BAA0B,CAAC,MAAM,CAAC;AAClD,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,IAAI,IAAI,GAAG,CAAC,QAAQ,KAAK,OAAO;AAChC,QAAQ,GAAG,CAAC,QAAQ,KAAK,WAAW;AACpC,QAAQ,GAAG,CAAC,QAAQ,KAAK,WAAW,EAAE;AACtC;AACA,QAAQ,OAAO,CAAC,IAAI,CAAC,uFAAuF,CAAC;AAC7G,IAAI;AACJ,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,OAAO,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ;AAChE,CAAC;AACD,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,MAAM,WAAW,GAAG,CAAC,MAAM,KAAK;AAChC,IAAI,MAAM,GAAG,GAAG,0BAA0B,CAAC,MAAM,CAAC;AAClD,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,QAAQ,OAAO,KAAK;AACpB,IAAI;AACJ,IAAI,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ;AACpC,CAAC;AACD,OAAO,CAAC,WAAW,GAAG,WAAW;AACjC,MAAM,0BAA0B,GAAG,CAAC,GAAG,KAAK;AAC5C,IAAI,IAAI,CAAC,GAAG,EAAE;AACd,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ;AACA,IAAI,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AAChC,QAAQ,OAAO,SAAS;AACxB,IAAI;AACJ;AACA,IAAI,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC;AACvB,CAAC;;"}
|
|
@@ -11,7 +11,22 @@ exports.isNextApiResponse = isNextApiResponse;
|
|
|
11
11
|
function isNextRequest(request) {
|
|
12
12
|
// NextRequest extends the Web Request API with additional convenience methods.
|
|
13
13
|
// Details: https://nextjs.org/docs/app/api-reference/functions/next-request#nexturl
|
|
14
|
-
|
|
14
|
+
//
|
|
15
|
+
// Use duck typing instead of instanceof to handle Lambda/serverless environments
|
|
16
|
+
// where Request constructor references may differ between invocations
|
|
17
|
+
return (typeof request === 'object' &&
|
|
18
|
+
request !== null &&
|
|
19
|
+
// NextRequest-specific properties
|
|
20
|
+
'nextUrl' in request &&
|
|
21
|
+
typeof request.nextUrl === 'object' &&
|
|
22
|
+
request.nextUrl !== null &&
|
|
23
|
+
'cookies' in request &&
|
|
24
|
+
// Basic Request API properties
|
|
25
|
+
'url' in request &&
|
|
26
|
+
typeof request.url === 'string' &&
|
|
27
|
+
'headers' in request &&
|
|
28
|
+
'method' in request &&
|
|
29
|
+
typeof request.method === 'string');
|
|
15
30
|
}
|
|
16
31
|
// AuthRoutesHandlersContext is the 2nd parameter type for the API route handlers in the App Router
|
|
17
32
|
function isAuthRoutesHandlersContext(context) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predicates.js","sources":["../../../../src/auth/utils/predicates.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isNextRequest = isNextRequest;\nexports.isAuthRoutesHandlersContext = isAuthRoutesHandlersContext;\nexports.isNextApiRequest = isNextApiRequest;\nexports.isNextApiResponse = isNextApiResponse;\n// NextRequest is the 1st parameter type for the API route handlers in the App Router\nfunction isNextRequest(request) {\n // NextRequest extends the Web Request API with additional convenience methods.\n // Details: https://nextjs.org/docs/app/api-reference/functions/next-request#nexturl\n
|
|
1
|
+
{"version":3,"file":"predicates.js","sources":["../../../../src/auth/utils/predicates.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isNextRequest = isNextRequest;\nexports.isAuthRoutesHandlersContext = isAuthRoutesHandlersContext;\nexports.isNextApiRequest = isNextApiRequest;\nexports.isNextApiResponse = isNextApiResponse;\n// NextRequest is the 1st parameter type for the API route handlers in the App Router\nfunction isNextRequest(request) {\n // NextRequest extends the Web Request API with additional convenience methods.\n // Details: https://nextjs.org/docs/app/api-reference/functions/next-request#nexturl\n //\n // Use duck typing instead of instanceof to handle Lambda/serverless environments\n // where Request constructor references may differ between invocations\n return (typeof request === 'object' &&\n request !== null &&\n // NextRequest-specific properties\n 'nextUrl' in request &&\n typeof request.nextUrl === 'object' &&\n request.nextUrl !== null &&\n 'cookies' in request &&\n // Basic Request API properties\n 'url' in request &&\n typeof request.url === 'string' &&\n 'headers' in request &&\n 'method' in request &&\n typeof request.method === 'string');\n}\n// AuthRoutesHandlersContext is the 2nd parameter type for the API route handlers in the App Router\nfunction isAuthRoutesHandlersContext(context) {\n return ('params' in context &&\n context.params !== undefined &&\n context.params !== null);\n}\n// NextApiRequest is the 1st parameter type for the API route handlers in the Pages Router\nfunction isNextApiRequest(request) {\n // Can't use `IncomingMessage` to validate the request is an instance of `NextApiRequest`\n // as `import from 'http'` breaks the Next.js build.\n // The `query` property is a convenience method added to the underlying `IncomingMessage`.\n return ('query' in request &&\n Object.prototype.toString.call(request.query) === '[object Object]');\n}\n// NextApiResponse is the 2nd parameter type for the API route handlers in the Pages Router\nfunction isNextApiResponse(response) {\n // Can't use `ServerResponse` to validate the request is an instance of `NextApiResponse`\n // as `import from 'http'` breaks the Next.js build.\n // The `redirect` method is a convenience method added to the underlying `ServerResponse`.\n return 'redirect' in response && typeof response.redirect === 'function';\n}\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;AAC7D,OAAO,CAAC,aAAa,GAAG,aAAa;AACrC,OAAO,CAAC,2BAA2B,GAAG,2BAA2B;AACjE,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;AAC3C,OAAO,CAAC,iBAAiB,GAAG,iBAAiB;AAC7C;AACA,SAAS,aAAa,CAAC,OAAO,EAAE;AAChC;AACA;AACA;AACA;AACA;AACA,IAAI,QAAQ,OAAO,OAAO,KAAK,QAAQ;AACvC,QAAQ,OAAO,KAAK,IAAI;AACxB;AACA,QAAQ,SAAS,IAAI,OAAO;AAC5B,QAAQ,OA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