@genesislcap/foundation-login 14.67.4 → 14.67.5-alpha-25da2b5.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/main/main.d.ts.map +1 -1
- package/dist/dts/routes/config.d.ts.map +1 -1
- package/dist/dts/routes/login-form/login-form.d.ts.map +1 -1
- package/dist/esm/main/main.js +3 -0
- package/dist/esm/routes/config.js +2 -0
- package/dist/esm/routes/login-form/login-form.js +23 -3
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAiB,WAAW,EAAc,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAwB,MAAM,4BAA4B,CAAC;AAG7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/main/main.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuC,OAAO,EAAE,MAAM,+BAA+B,CAAC;AAC7F,OAAO,EAAiB,WAAW,EAAc,MAAM,yBAAyB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAwB,MAAM,4BAA4B,CAAC;AAG7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmGG;AACH,qBACa,KAAM,SAAQ,WAAW;IACpC;;;;;OAKG;IACuB,MAAM,EAAG,gBAAgB,CAAC;IAEpD;;;OAGG;IACQ,SAAS,EAAG,SAAS,CAAC;IAEjC;;;OAGG;IACM,OAAO,EAAG,OAAO,CAAC;IAE3B;;;OAGG;IACS,KAAK,EAAE,OAAO,CAAS;IAEnC;;;OAGG;IACS,QAAQ,EAAG,WAAW,CAAC;IAEnC;;OAEG;IACG,iBAAiB;IAQvB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,gBAAgB;IAehB;;;OAGG;IACG,wBAAwB;IAa9B;;OAEG;IACH,SAAS,CAAC,sBAAsB;CAgBjC;AAED;;;;;GAKG;AACH,qBAIa,WAAY,SAAQ,KAAK;IAC9B,wBAAwB;CAG/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,mBAAmB,EAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAY,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA2B,mBAAmB,EAAS,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/routes/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,OAAO,EACP,mBAAmB,EAGpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,SAAS,EAAY,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAA2B,mBAAmB,EAAS,MAAM,wBAAwB,CAAC;AAE7F,OAAO,EAAsB,WAAW,EAAE,MAAM,SAAS,CAAC;AAQ1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAGxC;;;;;;;;;GASG;AACH,qBAAa,gBAAiB,SAAQ,mBAAmB,CAAC,QAAQ,CAAC;IAEzD,OAAO,CAAC,IAAI;IACP,OAAO,CAAC,SAAS;IACP,OAAO,CAAC,SAAS;IAC7B,OAAO,CAAC,OAAO;IACD,OAAO,CAAC,WAAW;gBAJ5B,IAAI,EAAE,IAAI,EACL,SAAS,EAAE,SAAS,EACV,SAAS,EAAE,mBAAmB,EAC1C,OAAO,EAAE,OAAO,EACF,WAAW,cAAqB;IAK1D,SAAS;IA+IT,SAAS,CAAC,CAAC,EAAE,IAAI,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;CAG/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login-form.d.ts","sourceRoot":"","sources":["../../../../src/routes/login-form/login-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"login-form.d.ts","sourceRoot":"","sources":["../../../../src/routes/login-form/login-form.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAMpE,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AACpC,OAAO,EAAE,GAAG,EAAe,MAAM,UAAU,CAAC;AAI5C,qBAKa,SAAU,SAAQ,SAAS;IAC1B,IAAI,EAAE,GAAG,EAAE,CAAM;IACjB,WAAW,EAAE,MAAM,CAAM;IACzB,UAAU,EAAE,OAAO,CAAS;IAElC,iBAAiB;IAoBjB,KAAK;IAeL,gBAAgB,IAAI,OAAO,CAAC,OAAO,GAAG,SAAS,CAAC;IAUtD,OAAO,CAAC,yBAAyB;IAgCjC,OAAO,CAAC,iBAAiB;IAczB,iBAAiB;IAiBjB,IACI,eAAe,WAElB;IAED,OAAO,CAAC,SAAS,CAYf;IAEF,cAAc,MAAO,WAAW,KAAG,IAAI,CAIrC;IAEF,UAAU;IAiBV,OAAO,CAAC,cAAc;IAYtB,OAAO,CAAC,cAAc;IAQhB,YAAY;IAIZ,aAAa;IAOb,KAAK,CAAC,WAAW,EAAE,QAAQ;IAwCjC,IACI,iBAAiB,6BAEpB;IAED,IAAI,qBAAqB,YAExB;IAED,IAAI,cAAc,YAEjB;CACF"}
|
package/dist/esm/main/main.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Container, inject, Registration } from '@microsoft/fast-foundation';
|
|
|
5
5
|
import { DefaultRouteRecognizer } from '@microsoft/fast-router';
|
|
6
6
|
import * as Components from '../components';
|
|
7
7
|
import { MainRouterConfig } from '../routes';
|
|
8
|
+
import { logger } from '../utils';
|
|
8
9
|
import { definition, standaloneDefinition } from './main.definition';
|
|
9
10
|
/**
|
|
10
11
|
* Defines the login class which handles account authentication from the front-end
|
|
@@ -125,6 +126,7 @@ let Login = class Login extends FASTElement {
|
|
|
125
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
126
127
|
this.registerDIDependencies();
|
|
127
128
|
_super.connectedCallback.call(this);
|
|
129
|
+
logger.debug('Login connected to the DOM');
|
|
128
130
|
yield this.registerCommonComponents();
|
|
129
131
|
this.checkForSSOToken();
|
|
130
132
|
});
|
|
@@ -154,6 +156,7 @@ let Login = class Login extends FASTElement {
|
|
|
154
156
|
checkForSSOToken() {
|
|
155
157
|
const queryParams = new URLSearchParams(window.location.search);
|
|
156
158
|
const ssoToken = queryParams.get('SSO_TOKEN');
|
|
159
|
+
logger.debug('Checking for SSO token', { queryParams, ssoToken });
|
|
157
160
|
if (ssoToken) {
|
|
158
161
|
if (window.opener) {
|
|
159
162
|
window.opener.sessionStorage.setItem('ssoToken', ssoToken);
|
|
@@ -4,6 +4,7 @@ import { Container, optional } from '@microsoft/fast-foundation';
|
|
|
4
4
|
import { RouterConfiguration, Route } from '@microsoft/fast-router';
|
|
5
5
|
import { defaultLayout } from '../layouts';
|
|
6
6
|
import { defaultLoginConfig, LoginConfig } from '../main';
|
|
7
|
+
import { logger } from '../utils';
|
|
7
8
|
import { ForgotPassword } from './forgot-password/forgot-password';
|
|
8
9
|
import { LoginForm } from './login-form/login-form';
|
|
9
10
|
import { NotFound } from './not-found/not-found';
|
|
@@ -119,6 +120,7 @@ let MainRouterConfig = class MainRouterConfig extends RouterConfiguration {
|
|
|
119
120
|
this.contributors.push({
|
|
120
121
|
navigate: (phase) => __awaiter(this, void 0, void 0, function* () {
|
|
121
122
|
const settings = phase.route.settings;
|
|
123
|
+
logger.debug('Login route change', phase.route.endpoint.path, phase);
|
|
122
124
|
/**
|
|
123
125
|
* TODO: Centralise
|
|
124
126
|
* Suspect this should be done via createEventSink, but it's not fully clear how-to do that as no docs
|
|
@@ -3,6 +3,7 @@ import { AuthError } from '@genesislcap/foundation-comms';
|
|
|
3
3
|
import { inIFrame, inSymphonyDesktop, openPopup } from '@genesislcap/foundation-utils';
|
|
4
4
|
import { customElement, DOM, observable, volatile } from '@microsoft/fast-element';
|
|
5
5
|
import { Route } from '@microsoft/fast-router';
|
|
6
|
+
import { hostUrl } from '../../main/config';
|
|
6
7
|
import { logger } from '../../utils';
|
|
7
8
|
import { BaseRoute } from '../base';
|
|
8
9
|
import { LoginFormStyles as styles } from './login-form.styles';
|
|
@@ -16,7 +17,10 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
16
17
|
this.fetchIDPs = () => __awaiter(this, void 0, void 0, function* () {
|
|
17
18
|
var _a, _b;
|
|
18
19
|
const ipdsEndpoint = `${(_b = (_a = this.config.sso) === null || _a === void 0 ? void 0 : _a.identityProvidersPath) !== null && _b !== void 0 ? _b : 'sso/list'}`;
|
|
19
|
-
|
|
20
|
+
const parsed = new URL(hostUrl);
|
|
21
|
+
const ipdsEndpointFull = `https://${parsed.hostname}/${ipdsEndpoint}`;
|
|
22
|
+
logger.debug(`Fetching IDPS from ${ipdsEndpointFull} `);
|
|
23
|
+
return fetch(ipdsEndpointFull)
|
|
20
24
|
.then((res) => {
|
|
21
25
|
if (res.ok)
|
|
22
26
|
return res;
|
|
@@ -40,6 +44,11 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
40
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
45
|
_super.connectedCallback.call(this);
|
|
42
46
|
this.ssoToggled = (_b = (_a = this.config.sso) === null || _a === void 0 ? void 0 : _a.toggled) !== null && _b !== void 0 ? _b : false;
|
|
47
|
+
logger.debug('Login form connected to the DOM', {
|
|
48
|
+
ssoToggled: this.ssoToggled,
|
|
49
|
+
isConnected: this.isConnected,
|
|
50
|
+
isLoggedIn: this.auth.isLoggedIn,
|
|
51
|
+
});
|
|
43
52
|
if (this.connect.isConnected && this.auth.isLoggedIn) {
|
|
44
53
|
yield this.credentialManager.preventSilentAccess();
|
|
45
54
|
yield this.auth.logout();
|
|
@@ -69,6 +78,7 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
69
78
|
}
|
|
70
79
|
toggleConnection() {
|
|
71
80
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
logger.debug('Login form - toggleConnection', { isConnected: this.connect.isConnected });
|
|
72
82
|
if (this.connect.isConnected) {
|
|
73
83
|
this.connect.disconnect();
|
|
74
84
|
logger.debug(`Disconnected from ${this.host}`);
|
|
@@ -80,6 +90,7 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
80
90
|
attemptLoginWhenConnected() {
|
|
81
91
|
this.connect.isConnectedSubject.subscribe((isConnected) => {
|
|
82
92
|
if (isConnected) {
|
|
93
|
+
logger.debug('Login form - attemptLoginWhenConnected');
|
|
83
94
|
/**
|
|
84
95
|
* Login preference flow taken from @genesislcap/foundation-login.
|
|
85
96
|
* We should sit down with Jose and team to cross check this. Reference code is bit hard to follow in places.
|
|
@@ -94,12 +105,13 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
94
105
|
if (this.ssoToggled) {
|
|
95
106
|
const ssoCredentials = cm.createSSOCredentials();
|
|
96
107
|
if (cm.validateSSOCredentials(ssoCredentials)) {
|
|
97
|
-
logger.debug(`Attempting to login with SSO
|
|
108
|
+
logger.debug(`Attempting to login with SSO.`, ssoCredentials);
|
|
98
109
|
this.login(ssoCredentials);
|
|
99
110
|
this.credentialManager.removeSSOToken(); // < sso tokens can only be used once, remove after login attempt
|
|
100
111
|
return;
|
|
101
112
|
}
|
|
102
113
|
}
|
|
114
|
+
logger.debug(`Attempting basic login`);
|
|
103
115
|
this.attemptBasicLogin();
|
|
104
116
|
}
|
|
105
117
|
});
|
|
@@ -117,6 +129,7 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
117
129
|
this.login(basicCredentials);
|
|
118
130
|
}
|
|
119
131
|
ssoToggledChanged() {
|
|
132
|
+
logger.debug(`SSO Toggle changed`, { ssoToggled: this.ssoToggled });
|
|
120
133
|
this.clearError();
|
|
121
134
|
if (this.ssoToggled) {
|
|
122
135
|
this.fetchIDPs()
|
|
@@ -137,6 +150,7 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
137
150
|
}
|
|
138
151
|
onClickSSO() {
|
|
139
152
|
const ssoLoginUrl = this.createLoginURL();
|
|
153
|
+
logger.debug(`Starting SSO login`, { ssoLoginUrl });
|
|
140
154
|
if (inIFrame()) {
|
|
141
155
|
if (inSymphonyDesktop()) {
|
|
142
156
|
// symphony/electron opens new window in the default browser instead
|
|
@@ -155,7 +169,10 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
155
169
|
const selectedIDP = this.idps.find((idp) => idp.id === this.selectedIDP);
|
|
156
170
|
const ssoLoginRoute = `/gwf/${selectedIDP.type}/login`;
|
|
157
171
|
const ssoLoginUrl = `${ssoLoginRoute}?idp=${selectedIDP.id}`;
|
|
158
|
-
|
|
172
|
+
const parsed = new URL(hostUrl);
|
|
173
|
+
const fullURL = `https://${parsed.hostname}${ssoLoginUrl}`;
|
|
174
|
+
logger.debug(`original login URL ${ssoLoginUrl}, resolved: ${fullURL}`);
|
|
175
|
+
return fullURL;
|
|
159
176
|
}
|
|
160
177
|
convertHostUrl() {
|
|
161
178
|
var _a, _b, _c, _d;
|
|
@@ -185,16 +202,19 @@ let LoginForm = class LoginForm extends BaseRoute {
|
|
|
185
202
|
login(credentials) {
|
|
186
203
|
return __awaiter(this, void 0, void 0, function* () {
|
|
187
204
|
try {
|
|
205
|
+
logger.debug(`Starting login`, { credentials });
|
|
188
206
|
const { authToken } = yield this.auth.login(credentials);
|
|
189
207
|
if (!authToken) {
|
|
190
208
|
throw new Error('Unable to login. Try again later.');
|
|
191
209
|
}
|
|
210
|
+
logger.debug(`Auth token received`, { authToken });
|
|
192
211
|
this.storeCredentials();
|
|
193
212
|
let url = this.config.defaultRedirectUrl;
|
|
194
213
|
if (this.session.returnUrl &&
|
|
195
214
|
!this.config.omitRedirectUrls.includes(this.session.returnUrl)) {
|
|
196
215
|
url = this.session.returnUrl;
|
|
197
216
|
}
|
|
217
|
+
logger.debug(`Redirecting back to ${url}`);
|
|
198
218
|
Route.path.push(url);
|
|
199
219
|
}
|
|
200
220
|
catch (err) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@genesislcap/foundation-login",
|
|
3
3
|
"description": "Genesis Foundation Login",
|
|
4
|
-
"version": "14.67.
|
|
4
|
+
"version": "14.67.5-alpha-25da2b5.0",
|
|
5
5
|
"license": "SEE LICENSE IN license.txt",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/foundation-login.d.ts",
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"test:debug": "genx test --debug"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"@genesislcap/foundation-testing": "14.67.
|
|
53
|
-
"@genesislcap/genx": "14.67.
|
|
52
|
+
"@genesislcap/foundation-testing": "14.67.5-alpha-25da2b5.0",
|
|
53
|
+
"@genesislcap/genx": "14.67.5-alpha-25da2b5.0",
|
|
54
54
|
"rimraf": "^3.0.2"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@genesislcap/foundation-comms": "14.67.
|
|
58
|
-
"@genesislcap/foundation-ui": "14.67.
|
|
59
|
-
"@genesislcap/foundation-utils": "14.67.
|
|
60
|
-
"@genesislcap/foundation-zero": "14.67.
|
|
57
|
+
"@genesislcap/foundation-comms": "14.67.5-alpha-25da2b5.0",
|
|
58
|
+
"@genesislcap/foundation-ui": "14.67.5-alpha-25da2b5.0",
|
|
59
|
+
"@genesislcap/foundation-utils": "14.67.5-alpha-25da2b5.0",
|
|
60
|
+
"@genesislcap/foundation-zero": "14.67.5-alpha-25da2b5.0",
|
|
61
61
|
"@microsoft/fast-components": "^2.21.3",
|
|
62
62
|
"@microsoft/fast-element": "^1.7.0",
|
|
63
63
|
"@microsoft/fast-foundation": "^2.33.2",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"access": "public"
|
|
75
75
|
},
|
|
76
76
|
"customElements": "dist/custom-elements.json",
|
|
77
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "e49c792ce90f574af9cc459f6878e647cb4bc60b"
|
|
78
78
|
}
|