@genesislcap/foundation-auth 15.80.0 → 15.81.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/dts/machine/machine.d.ts +5 -0
- package/dist/dts/machine/machine.d.ts.map +1 -1
- package/dist/dts/machine/sso-popup.d.ts +11 -0
- package/dist/dts/machine/sso-popup.d.ts.map +1 -0
- package/dist/dts/routes/login/login.d.ts.map +1 -1
- package/dist/esm/machine/machine.js +15 -6
- package/dist/esm/machine/sso-popup.js +20 -0
- package/dist/esm/machine/types.js +1 -1
- package/dist/esm/routes/login/login.js +5 -2
- package/dist/foundation-auth.api.json +31 -0
- package/dist/foundation-auth.d.ts +5 -0
- package/package.json +17 -17
|
@@ -32,6 +32,11 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
32
32
|
*/
|
|
33
33
|
getFromContainer(): this;
|
|
34
34
|
protected captureAuthQueryParams(): QueryParams;
|
|
35
|
+
/**
|
|
36
|
+
* Whether the opener opened this window for SSO and is waiting for its token. Override if the app opens its own
|
|
37
|
+
* SSO popups.
|
|
38
|
+
*/
|
|
39
|
+
protected isSSOPopup(): boolean;
|
|
35
40
|
protected convertQueryParamsToLoginParams(params: QueryParams): LoginParams;
|
|
36
41
|
protected createFetchMachineEvent(url: string, msg?: {}): FetchMachineEvent;
|
|
37
42
|
protected onIdleEvents: () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../../../src/machine/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EAEf,YAAY,EACZ,iBAAiB,EAMjB,OAAO,EACR,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,IAAI,EAAE,MAAM,8BAA8B,CAAC;AACpD,OAAO,EACL,IAAI,EASL,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAEjD,OA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rB,EAAE,EAAE,iBAAiB,EAClC,IAAI,EAAE,IAAI,EACG,aAAa,EAAE,iBAAiB,EACvC,MAAM,EAAE,UAAU,EACjB,OAAO,EAAE,WAAW;IA2yB3C,KAAK,CACH,OAAO,GAAE,kBAAkB,CAAC,OAAO,IAAI,CAAC,OAAO,CAM9C;IAKH;;OAEG;IACH,gBAAgB,IAAI,IAAI;IAIxB,SAAS,CAAC,sBAAsB,IAAI,WAAW;IAQ/C;;;OAGG;IACH,SAAS,CAAC,UAAU,IAAI,OAAO;IAI/B,SAAS,CAAC,+BAA+B,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW;IAuB3E,SAAS,CAAC,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,iBAAiB;IAgB3E,SAAS,CAAC,YAAY;;;;;;;;;;;;;;;;;;;;;MAwBpB;IAEF,SAAS,CAAC,aAAa;;;MAGpB;IAEH;;OAEG;IACH,SAAS,CAAC,qBAAqB,GAAI,oBAAoB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA0B1D;CACJ;AAED;;;GAGG;AACH,eAAO,MAAM,WAAW,mEAA0E,CAAC;AAEnG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,cAAc,IAAI,WAAW,CAE5C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const SSO_POPUP_KEY = "genesisAuthSSOPopup";
|
|
2
|
+
/**
|
|
3
|
+
* Remembers the popup this window opened for SSO, so only that popup hands its token back.
|
|
4
|
+
*/
|
|
5
|
+
export declare const rememberSSOPopup: (popup: Window) => void;
|
|
6
|
+
/**
|
|
7
|
+
* Whether this window is the popup its opener opened for SSO. A window keeps its identity across the IdP round
|
|
8
|
+
* trip, and reading from a cross-origin opener throws, so neither another popout nor a foreign opener matches.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isOpenedForSSO: () => boolean;
|
|
11
|
+
//# sourceMappingURL=sso-popup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sso-popup.d.ts","sourceRoot":"","sources":["../../../src/machine/sso-popup.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,wBAAwB,CAAC;AAInD;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,OAAO,MAAM,SAE7C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,OAOjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/routes/login/login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,iBAAiB,EAAkB,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../../src/routes/login/login.ts"],"names":[],"mappings":"AAEA,OAAO,EAAoB,iBAAiB,EAAkB,MAAM,kBAAkB,CAAC;AAEvF,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAIpC;;;;;;;;;;;;;GAaG;AACH,qBAKa,KAAM,SAAQ,SAAS;IACf,iBAAiB,EAAE,iBAAiB,CAAC;IAExD,iBAAiB;IAYjB,OAAO,CAAC,iBAAiB;IAezB,IACI,cAAc,WAMjB;IAED,UAAU;IAqBJ,aAAa;IAInB,KAAK,CAAC,MAAM,EAAE,WAAW;IAIzB,MAAM;IAIN,IAAI,cAAc,YAEjB;IAED,IAAI,aAAa,YAMhB;CACF"}
|
|
@@ -12,6 +12,7 @@ import { AuthRouting } from '../routes/routing';
|
|
|
12
12
|
import { logger } from '../utils';
|
|
13
13
|
import { setError } from './actions';
|
|
14
14
|
import { refreshCookieSession } from './session-refresh';
|
|
15
|
+
import { isOpenedForSSO } from './sso-popup';
|
|
15
16
|
import { defaultAuthMachineContext, isLoginParams, isQueryParams } from './types';
|
|
16
17
|
/**
|
|
17
18
|
* Default AuthMachine.
|
|
@@ -105,7 +106,7 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
105
106
|
/**
|
|
106
107
|
* Handle SSO popups first
|
|
107
108
|
*/
|
|
108
|
-
guard: and(['hasSSOToken', '
|
|
109
|
+
guard: and(['hasSSOToken', 'isSSOPopup']),
|
|
109
110
|
actions: 'handSSOTokenToWindowOpener',
|
|
110
111
|
target: '#authMachine.idle',
|
|
111
112
|
},
|
|
@@ -807,9 +808,9 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
807
808
|
hasParams: ({ context }) => context.params !== undefined,
|
|
808
809
|
hasLoginParams: ({ context }) => isLoginParams(context.params),
|
|
809
810
|
hasQueryParams: ({ context }) => isQueryParams(context.params),
|
|
810
|
-
hasSSOToken: ({ context }) => isQueryParams(context.params) && context.params.SSO_TOKEN
|
|
811
|
-
hasMFACode: ({ context }) => isQueryParams(context.params) && context.params.MFA_CODE
|
|
812
|
-
|
|
811
|
+
hasSSOToken: ({ context }) => isQueryParams(context.params) && Boolean(context.params.SSO_TOKEN),
|
|
812
|
+
hasMFACode: ({ context }) => isQueryParams(context.params) && Boolean(context.params.MFA_CODE),
|
|
813
|
+
isSSOPopup: () => this.isSSOPopup(),
|
|
813
814
|
isUnauthorizedError: ({ event }) => {
|
|
814
815
|
if (isErrorEvent(event)) {
|
|
815
816
|
return isUnauthorizedError(event.data);
|
|
@@ -876,12 +877,20 @@ let DefaultAuthMachine = class DefaultAuthMachine extends AbstractMachine {
|
|
|
876
877
|
return this.container.get(AuthMachine);
|
|
877
878
|
}
|
|
878
879
|
captureAuthQueryParams() {
|
|
880
|
+
var _a, _b;
|
|
879
881
|
const queryParams = new URLSearchParams(window.location.search);
|
|
880
882
|
return {
|
|
881
|
-
SSO_TOKEN: queryParams.get('SSO_TOKEN'),
|
|
882
|
-
MFA_CODE: queryParams.get('MFA_CODE'),
|
|
883
|
+
SSO_TOKEN: (_a = queryParams.get('SSO_TOKEN')) !== null && _a !== void 0 ? _a : undefined,
|
|
884
|
+
MFA_CODE: (_b = queryParams.get('MFA_CODE')) !== null && _b !== void 0 ? _b : undefined,
|
|
883
885
|
};
|
|
884
886
|
}
|
|
887
|
+
/**
|
|
888
|
+
* Whether the opener opened this window for SSO and is waiting for its token. Override if the app opens its own
|
|
889
|
+
* SSO popups.
|
|
890
|
+
*/
|
|
891
|
+
isSSOPopup() {
|
|
892
|
+
return isOpenedForSSO();
|
|
893
|
+
}
|
|
885
894
|
convertQueryParamsToLoginParams(params) {
|
|
886
895
|
const ssoCredentials = params.SSO_TOKEN
|
|
887
896
|
? {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const SSO_POPUP_KEY = 'genesisAuthSSOPopup';
|
|
2
|
+
/**
|
|
3
|
+
* Remembers the popup this window opened for SSO, so only that popup hands its token back.
|
|
4
|
+
*/
|
|
5
|
+
export const rememberSSOPopup = (popup) => {
|
|
6
|
+
window[SSO_POPUP_KEY] = popup;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Whether this window is the popup its opener opened for SSO. A window keeps its identity across the IdP round
|
|
10
|
+
* trip, and reading from a cross-origin opener throws, so neither another popout nor a foreign opener matches.
|
|
11
|
+
*/
|
|
12
|
+
export const isOpenedForSSO = () => {
|
|
13
|
+
try {
|
|
14
|
+
const opener = window.opener;
|
|
15
|
+
return !!opener && opener[SSO_POPUP_KEY] === window;
|
|
16
|
+
}
|
|
17
|
+
catch (_a) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
@@ -59,5 +59,5 @@ export function isResetPasswordParams(params) {
|
|
|
59
59
|
*/
|
|
60
60
|
export function isQueryParams(params) {
|
|
61
61
|
const queryParams = params;
|
|
62
|
-
return queryParams && (queryParams.SSO_TOKEN
|
|
62
|
+
return Boolean(queryParams && (queryParams.SSO_TOKEN || queryParams.MFA_CODE));
|
|
63
63
|
}
|
|
@@ -2,6 +2,7 @@ import { __awaiter, __decorate } from "tslib";
|
|
|
2
2
|
import { inIFrame, inSymphonyDesktop, openPopup } from '@genesislcap/foundation-utils';
|
|
3
3
|
import { customElement, volatile } from '@microsoft/fast-element';
|
|
4
4
|
import { CredentialManager, CredentialType } from '../../credential';
|
|
5
|
+
import { rememberSSOPopup } from '../../machine/sso-popup';
|
|
5
6
|
import { logger } from '../../utils';
|
|
6
7
|
import { BaseRoute } from '../base';
|
|
7
8
|
import { LoginStyles as styles } from './login.styles';
|
|
@@ -62,10 +63,12 @@ let Login = class Login extends BaseRoute {
|
|
|
62
63
|
if (inSymphonyDesktop()) {
|
|
63
64
|
// symphony/electron opens new window in the default browser instead
|
|
64
65
|
// popup within electron, so we have to navigate manually
|
|
65
|
-
openPopup('', 'symphony')
|
|
66
|
+
const popup = openPopup('', 'symphony');
|
|
67
|
+
rememberSSOPopup(popup);
|
|
68
|
+
popup.location.assign(ssoLoginUrl);
|
|
66
69
|
}
|
|
67
70
|
else {
|
|
68
|
-
openPopup(ssoLoginUrl, 'Login');
|
|
71
|
+
rememberSSOPopup(openPopup(ssoLoginUrl, 'Login'));
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
74
|
else {
|
|
@@ -6112,6 +6112,37 @@
|
|
|
6112
6112
|
"isAbstract": false,
|
|
6113
6113
|
"name": "getFromContainer"
|
|
6114
6114
|
},
|
|
6115
|
+
{
|
|
6116
|
+
"kind": "Method",
|
|
6117
|
+
"canonicalReference": "@genesislcap/foundation-auth!DefaultAuthMachine#isSSOPopup:member(1)",
|
|
6118
|
+
"docComment": "/**\n * Whether the opener opened this window for SSO and is waiting for its token. Override if the app opens its own SSO popups.\n */\n",
|
|
6119
|
+
"excerptTokens": [
|
|
6120
|
+
{
|
|
6121
|
+
"kind": "Content",
|
|
6122
|
+
"text": "protected isSSOPopup(): "
|
|
6123
|
+
},
|
|
6124
|
+
{
|
|
6125
|
+
"kind": "Content",
|
|
6126
|
+
"text": "boolean"
|
|
6127
|
+
},
|
|
6128
|
+
{
|
|
6129
|
+
"kind": "Content",
|
|
6130
|
+
"text": ";"
|
|
6131
|
+
}
|
|
6132
|
+
],
|
|
6133
|
+
"isStatic": false,
|
|
6134
|
+
"returnTypeTokenRange": {
|
|
6135
|
+
"startIndex": 1,
|
|
6136
|
+
"endIndex": 2
|
|
6137
|
+
},
|
|
6138
|
+
"releaseTag": "Public",
|
|
6139
|
+
"isProtected": true,
|
|
6140
|
+
"overloadIndex": 1,
|
|
6141
|
+
"parameters": [],
|
|
6142
|
+
"isOptional": false,
|
|
6143
|
+
"isAbstract": false,
|
|
6144
|
+
"name": "isSSOPopup"
|
|
6145
|
+
},
|
|
6115
6146
|
{
|
|
6116
6147
|
"kind": "Property",
|
|
6117
6148
|
"canonicalReference": "@genesislcap/foundation-auth!DefaultAuthMachine#loginDetailsStateNode:member",
|
|
@@ -1030,6 +1030,11 @@ export declare class DefaultAuthMachine extends AbstractMachine<AuthMachineConte
|
|
|
1030
1030
|
*/
|
|
1031
1031
|
getFromContainer(): this;
|
|
1032
1032
|
protected captureAuthQueryParams(): QueryParams;
|
|
1033
|
+
/**
|
|
1034
|
+
* Whether the opener opened this window for SSO and is waiting for its token. Override if the app opens its own
|
|
1035
|
+
* SSO popups.
|
|
1036
|
+
*/
|
|
1037
|
+
protected isSSOPopup(): boolean;
|
|
1033
1038
|
protected convertQueryParamsToLoginParams(params: QueryParams): LoginParams;
|
|
1034
1039
|
protected createFetchMachineEvent(url: string, msg?: {}): FetchMachineEvent;
|
|
1035
1040
|
protected onIdleEvents: () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-auth",
|
|
3
3
|
"description": "Genesis Foundation Auth",
|
|
4
|
-
"version": "15.
|
|
4
|
+
"version": "15.81.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-auth.d.ts",
|
|
@@ -129,24 +129,24 @@
|
|
|
129
129
|
}
|
|
130
130
|
},
|
|
131
131
|
"devDependencies": {
|
|
132
|
-
"@genesislcap/foundation-testing": "15.
|
|
133
|
-
"@genesislcap/genx": "15.
|
|
134
|
-
"@genesislcap/ts-builder": "15.
|
|
135
|
-
"@genesislcap/uvu-playwright-builder": "15.
|
|
136
|
-
"@genesislcap/vite-builder": "15.
|
|
137
|
-
"@genesislcap/webpack-builder": "15.
|
|
132
|
+
"@genesislcap/foundation-testing": "15.81.0",
|
|
133
|
+
"@genesislcap/genx": "15.81.0",
|
|
134
|
+
"@genesislcap/ts-builder": "15.81.0",
|
|
135
|
+
"@genesislcap/uvu-playwright-builder": "15.81.0",
|
|
136
|
+
"@genesislcap/vite-builder": "15.81.0",
|
|
137
|
+
"@genesislcap/webpack-builder": "15.81.0"
|
|
138
138
|
},
|
|
139
139
|
"dependencies": {
|
|
140
|
-
"@genesislcap/foundation-comms": "15.
|
|
141
|
-
"@genesislcap/foundation-events": "15.
|
|
142
|
-
"@genesislcap/foundation-i18n": "15.
|
|
143
|
-
"@genesislcap/foundation-logger": "15.
|
|
144
|
-
"@genesislcap/foundation-state-machine": "15.
|
|
145
|
-
"@genesislcap/foundation-store": "15.
|
|
146
|
-
"@genesislcap/foundation-ui": "15.
|
|
147
|
-
"@genesislcap/foundation-user": "15.
|
|
148
|
-
"@genesislcap/foundation-utils": "15.
|
|
149
|
-
"@genesislcap/rapid-design-system": "15.
|
|
140
|
+
"@genesislcap/foundation-comms": "15.81.0",
|
|
141
|
+
"@genesislcap/foundation-events": "15.81.0",
|
|
142
|
+
"@genesislcap/foundation-i18n": "15.81.0",
|
|
143
|
+
"@genesislcap/foundation-logger": "15.81.0",
|
|
144
|
+
"@genesislcap/foundation-state-machine": "15.81.0",
|
|
145
|
+
"@genesislcap/foundation-store": "15.81.0",
|
|
146
|
+
"@genesislcap/foundation-ui": "15.81.0",
|
|
147
|
+
"@genesislcap/foundation-user": "15.81.0",
|
|
148
|
+
"@genesislcap/foundation-utils": "15.81.0",
|
|
149
|
+
"@genesislcap/rapid-design-system": "15.81.0",
|
|
150
150
|
"@microsoft/fast-components": "2.30.6",
|
|
151
151
|
"@microsoft/fast-element": "1.14.0",
|
|
152
152
|
"@microsoft/fast-foundation": "2.50.0",
|