@aws-amplify/auth 6.5.1-unstable.ffa8a24.0 → 6.5.2-events.619318.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js +3 -1
- package/dist/cjs/providers/cognito/utils/oauth/getRedirectUrl.js.map +1 -1
- package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs +3 -1
- package/dist/esm/providers/cognito/utils/oauth/getRedirectUrl.mjs.map +1 -1
- package/package.json +5 -5
- package/src/providers/cognito/utils/oauth/getRedirectUrl.ts +1 -0
|
@@ -29,7 +29,9 @@ function getRedirectUrl(redirects, preferredRedirectUrl) {
|
|
|
29
29
|
}
|
|
30
30
|
exports.getRedirectUrl = getRedirectUrl;
|
|
31
31
|
// origin + pathname => https://example.com/app
|
|
32
|
-
const isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
32
|
+
const isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
33
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
34
|
+
String(window.location.origin + window.location.pathname ?? '/'));
|
|
33
35
|
// domain => outlook.live.com, github.com
|
|
34
36
|
const isTheSameDomain = (redirect) => redirect.includes(String(window.location.hostname));
|
|
35
37
|
const isHttp = (redirect) => redirect.startsWith('http://');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRedirectUrl.js","sources":["../../../../../../src/providers/cognito/utils/oauth/getRedirectUrl.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getRedirectUrl = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst constants_1 = require(\"../../../../errors/constants\");\n/** @internal */\nfunction getRedirectUrl(redirects, preferredRedirectUrl) {\n if (preferredRedirectUrl) {\n const redirectUrl = redirects?.find(redirect => redirect === preferredRedirectUrl);\n if (!redirectUrl) {\n throw constants_1.invalidPreferredRedirectUrlException;\n }\n return redirectUrl;\n }\n else {\n const redirectUrlFromTheSameOrigin = redirects?.find(isSameOriginAndPathName) ??\n redirects?.find(isTheSameDomain);\n const redirectUrlFromDifferentOrigin = redirects?.find(isHttps) ?? redirects?.find(isHttp);\n if (redirectUrlFromTheSameOrigin) {\n return redirectUrlFromTheSameOrigin;\n }\n else if (redirectUrlFromDifferentOrigin) {\n throw constants_1.invalidOriginException;\n }\n throw constants_1.invalidRedirectException;\n }\n}\nexports.getRedirectUrl = getRedirectUrl;\n// origin + pathname => https://example.com/app\nconst isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
1
|
+
{"version":3,"file":"getRedirectUrl.js","sources":["../../../../../../src/providers/cognito/utils/oauth/getRedirectUrl.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getRedirectUrl = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst constants_1 = require(\"../../../../errors/constants\");\n/** @internal */\nfunction getRedirectUrl(redirects, preferredRedirectUrl) {\n if (preferredRedirectUrl) {\n const redirectUrl = redirects?.find(redirect => redirect === preferredRedirectUrl);\n if (!redirectUrl) {\n throw constants_1.invalidPreferredRedirectUrlException;\n }\n return redirectUrl;\n }\n else {\n const redirectUrlFromTheSameOrigin = redirects?.find(isSameOriginAndPathName) ??\n redirects?.find(isTheSameDomain);\n const redirectUrlFromDifferentOrigin = redirects?.find(isHttps) ?? redirects?.find(isHttp);\n if (redirectUrlFromTheSameOrigin) {\n return redirectUrlFromTheSameOrigin;\n }\n else if (redirectUrlFromDifferentOrigin) {\n throw constants_1.invalidOriginException;\n }\n throw constants_1.invalidRedirectException;\n }\n}\nexports.getRedirectUrl = getRedirectUrl;\n// origin + pathname => https://example.com/app\nconst isSameOriginAndPathName = (redirect) => redirect.startsWith(\n// eslint-disable-next-line no-constant-binary-expression\nString(window.location.origin + window.location.pathname ?? '/'));\n// domain => outlook.live.com, github.com\nconst isTheSameDomain = (redirect) => redirect.includes(String(window.location.hostname));\nconst isHttp = (redirect) => redirect.startsWith('http://');\nconst isHttps = (redirect) => redirect.startsWith('https://');\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,cAAc,GAAG,KAAK,CAAC,CAAC;AAChC;AACA;AACA,MAAM,WAAW,GAAG,OAAO,CAAC,8BAA8B,CAAC,CAAC;AAC5D;AACA,SAAS,cAAc,CAAC,SAAS,EAAE,oBAAoB,EAAE;AACzD,IAAI,IAAI,oBAAoB,EAAE;AAC9B,QAAQ,MAAM,WAAW,GAAG,SAAS,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,oBAAoB,CAAC,CAAC;AAC3F,QAAQ,IAAI,CAAC,WAAW,EAAE;AAC1B,YAAY,MAAM,WAAW,CAAC,oCAAoC,CAAC;AACnE,SAAS;AACT,QAAQ,OAAO,WAAW,CAAC;AAC3B,KAAK;AACL,SAAS;AACT,QAAQ,MAAM,4BAA4B,GAAG,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC;AACrF,YAAY,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAC7C,QAAQ,MAAM,8BAA8B,GAAG,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACnG,QAAQ,IAAI,4BAA4B,EAAE;AAC1C,YAAY,OAAO,4BAA4B,CAAC;AAChD,SAAS;AACT,aAAa,IAAI,8BAA8B,EAAE;AACjD,YAAY,MAAM,WAAW,CAAC,sBAAsB,CAAC;AACrD,SAAS;AACT,QAAQ,MAAM,WAAW,CAAC,wBAAwB,CAAC;AACnD,KAAK;AACL,CAAC;AACD,OAAO,CAAC,cAAc,GAAG,cAAc,CAAC;AACxC;AACA,MAAM,uBAAuB,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU;AACjE;AACA,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;AAClE;AACA,MAAM,eAAe,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1F,MAAM,MAAM,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC5D,MAAM,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;;"}
|
|
@@ -25,7 +25,9 @@ function getRedirectUrl(redirects, preferredRedirectUrl) {
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
// origin + pathname => https://example.com/app
|
|
28
|
-
const isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
28
|
+
const isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
29
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
30
|
+
String(window.location.origin + window.location.pathname ?? '/'));
|
|
29
31
|
// domain => outlook.live.com, github.com
|
|
30
32
|
const isTheSameDomain = (redirect) => redirect.includes(String(window.location.hostname));
|
|
31
33
|
const isHttp = (redirect) => redirect.startsWith('http://');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRedirectUrl.mjs","sources":["../../../../../../src/providers/cognito/utils/oauth/getRedirectUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { invalidOriginException, invalidPreferredRedirectUrlException, invalidRedirectException, } from '../../../../errors/constants';\n/** @internal */\nexport function getRedirectUrl(redirects, preferredRedirectUrl) {\n if (preferredRedirectUrl) {\n const redirectUrl = redirects?.find(redirect => redirect === preferredRedirectUrl);\n if (!redirectUrl) {\n throw invalidPreferredRedirectUrlException;\n }\n return redirectUrl;\n }\n else {\n const redirectUrlFromTheSameOrigin = redirects?.find(isSameOriginAndPathName) ??\n redirects?.find(isTheSameDomain);\n const redirectUrlFromDifferentOrigin = redirects?.find(isHttps) ?? redirects?.find(isHttp);\n if (redirectUrlFromTheSameOrigin) {\n return redirectUrlFromTheSameOrigin;\n }\n else if (redirectUrlFromDifferentOrigin) {\n throw invalidOriginException;\n }\n throw invalidRedirectException;\n }\n}\n// origin + pathname => https://example.com/app\nconst isSameOriginAndPathName = (redirect) => redirect.startsWith(
|
|
1
|
+
{"version":3,"file":"getRedirectUrl.mjs","sources":["../../../../../../src/providers/cognito/utils/oauth/getRedirectUrl.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { invalidOriginException, invalidPreferredRedirectUrlException, invalidRedirectException, } from '../../../../errors/constants';\n/** @internal */\nexport function getRedirectUrl(redirects, preferredRedirectUrl) {\n if (preferredRedirectUrl) {\n const redirectUrl = redirects?.find(redirect => redirect === preferredRedirectUrl);\n if (!redirectUrl) {\n throw invalidPreferredRedirectUrlException;\n }\n return redirectUrl;\n }\n else {\n const redirectUrlFromTheSameOrigin = redirects?.find(isSameOriginAndPathName) ??\n redirects?.find(isTheSameDomain);\n const redirectUrlFromDifferentOrigin = redirects?.find(isHttps) ?? redirects?.find(isHttp);\n if (redirectUrlFromTheSameOrigin) {\n return redirectUrlFromTheSameOrigin;\n }\n else if (redirectUrlFromDifferentOrigin) {\n throw invalidOriginException;\n }\n throw invalidRedirectException;\n }\n}\n// origin + pathname => https://example.com/app\nconst isSameOriginAndPathName = (redirect) => redirect.startsWith(\n// eslint-disable-next-line no-constant-binary-expression\nString(window.location.origin + window.location.pathname ?? '/'));\n// domain => outlook.live.com, github.com\nconst isTheSameDomain = (redirect) => redirect.includes(String(window.location.hostname));\nconst isHttp = (redirect) => redirect.startsWith('http://');\nconst isHttps = (redirect) => redirect.startsWith('https://');\n"],"names":[],"mappings":";;AAAA;AACA;AAEA;AACO,SAAS,cAAc,CAAC,SAAS,EAAE,oBAAoB,EAAE;AAChE,IAAI,IAAI,oBAAoB,EAAE;AAC9B,QAAQ,MAAM,WAAW,GAAG,SAAS,EAAE,IAAI,CAAC,QAAQ,IAAI,QAAQ,KAAK,oBAAoB,CAAC,CAAC;AAC3F,QAAQ,IAAI,CAAC,WAAW,EAAE;AAC1B,YAAY,MAAM,oCAAoC,CAAC;AACvD,SAAS;AACT,QAAQ,OAAO,WAAW,CAAC;AAC3B,KAAK;AACL,SAAS;AACT,QAAQ,MAAM,4BAA4B,GAAG,SAAS,EAAE,IAAI,CAAC,uBAAuB,CAAC;AACrF,YAAY,SAAS,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;AAC7C,QAAQ,MAAM,8BAA8B,GAAG,SAAS,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;AACnG,QAAQ,IAAI,4BAA4B,EAAE;AAC1C,YAAY,OAAO,4BAA4B,CAAC;AAChD,SAAS;AACT,aAAa,IAAI,8BAA8B,EAAE;AACjD,YAAY,MAAM,sBAAsB,CAAC;AACzC,SAAS;AACT,QAAQ,MAAM,wBAAwB,CAAC;AACvC,KAAK;AACL,CAAC;AACD;AACA,MAAM,uBAAuB,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU;AACjE;AACA,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,IAAI,GAAG,CAAC,CAAC,CAAC;AAClE;AACA,MAAM,eAAe,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;AAC1F,MAAM,MAAM,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;AAC5D,MAAM,OAAO,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,UAAU,CAAC,UAAU,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/auth",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.2-events.0619318.0+0619318",
|
|
4
4
|
"description": "Auth category of aws-amplify",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"module": "./dist/esm/index.mjs",
|
|
@@ -94,13 +94,13 @@
|
|
|
94
94
|
"tslib": "^2.5.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependencies": {
|
|
97
|
-
"@aws-amplify/core": "6.4.
|
|
97
|
+
"@aws-amplify/core": "6.4.5-events.0619318.0+0619318"
|
|
98
98
|
},
|
|
99
99
|
"devDependencies": {
|
|
100
|
-
"@aws-amplify/core": "6.4.
|
|
101
|
-
"@aws-amplify/react-native": "1.1.7-
|
|
100
|
+
"@aws-amplify/core": "6.4.5-events.0619318.0+0619318",
|
|
101
|
+
"@aws-amplify/react-native": "1.1.7-events.0619318.0+0619318",
|
|
102
102
|
"@jest/test-sequencer": "^29.7.0",
|
|
103
103
|
"typescript": "5.0.2"
|
|
104
104
|
},
|
|
105
|
-
"gitHead": "
|
|
105
|
+
"gitHead": "06193189d7eb5d64880eb70d94c0a82748cc2097"
|
|
106
106
|
}
|
|
@@ -39,6 +39,7 @@ export function getRedirectUrl(
|
|
|
39
39
|
// origin + pathname => https://example.com/app
|
|
40
40
|
const isSameOriginAndPathName = (redirect: string) =>
|
|
41
41
|
redirect.startsWith(
|
|
42
|
+
// eslint-disable-next-line no-constant-binary-expression
|
|
42
43
|
String(window.location.origin + window.location.pathname ?? '/'),
|
|
43
44
|
);
|
|
44
45
|
// domain => outlook.live.com, github.com
|