@open-rlb/ng-app 3.0.16 → 3.0.18

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.
@@ -1317,7 +1317,6 @@ class AuthenticationService {
1317
1317
  // } else {
1318
1318
  return this.oidc.checkAuthMultiple(url)
1319
1319
  .pipe(tap(data => {
1320
- this.logger.warn(`oidc checkAuthMultiple check, response: ${JSON.stringify(data)}; looking for at least one isAuthenticated`);
1321
1320
  const authenticatedConfig = data.find(o => o.isAuthenticated);
1322
1321
  if (authenticatedConfig && authenticatedConfig.configId) {
1323
1322
  this.logger.info(`User is authenticated with provider: ${authenticatedConfig.configId}. Updating Store.`);
@@ -1325,19 +1324,25 @@ class AuthenticationService {
1325
1324
  this.store.dispatch(AuthActions.setCurrentProvider({
1326
1325
  currentProvider: authenticatedConfig.configId
1327
1326
  }));
1328
- // Redirect logic -> clean query params
1329
- const redirect = this.cookiesService.getCookie('loginRedirectUrl');
1327
+ const redirect = localStorage.getItem('loginRedirectUrl');
1328
+ //const redirect = this.cookiesService.getCookie('loginRedirectUrl');
1330
1329
  this.logger.info(`Correct provider dispatched, redirectUrl: ${redirect}`);
1331
1330
  if (redirect) {
1332
- this.cookiesService.deleteCookie('loginRedirectUrl');
1333
- this.router.navigateByUrl(redirect, { replaceUrl: true });
1331
+ localStorage.removeItem('loginRedirectUrl');
1332
+ // this.cookiesService.deleteCookie('loginRedirectUrl');
1333
+ // setTimeout to prevent NavigationCancel
1334
+ // this allows current angular navigation cycle (handle URL with code/state) to complete
1335
+ setTimeout(() => {
1336
+ this.router.navigateByUrl(redirect, { replaceUrl: true });
1337
+ }, 0);
1334
1338
  }
1335
1339
  else {
1336
- this.router.navigate([], {
1337
- queryParams: {},
1338
- replaceUrl: true,
1339
- relativeTo: this.router.routerState.root
1340
- });
1340
+ this.logger.info(`User authenticated, no redirectUrl found. Staying on current route.`);
1341
+ // this.router.navigate([], {
1342
+ // queryParams: {},
1343
+ // replaceUrl: true,
1344
+ // relativeTo: this.router.routerState.root
1345
+ // });
1341
1346
  }
1342
1347
  }
1343
1348
  else {
@@ -1355,7 +1360,8 @@ class AuthenticationService {
1355
1360
  }
1356
1361
  login(targetUrl) {
1357
1362
  const returnUrl = targetUrl || this.router.url || '/';
1358
- this.cookiesService.setCookie('loginRedirectUrl', returnUrl, 1);
1363
+ // this.cookiesService.setCookie('loginRedirectUrl', returnUrl, 1);
1364
+ localStorage.setItem('loginRedirectUrl', returnUrl);
1359
1365
  this.logger.log(`call login method, loginRedirectUrl: ${returnUrl}`);
1360
1366
  // electron
1361
1367
  if (typeof (process) !== 'undefined' &&