@open-rlb/ng-app 3.0.9 → 3.0.10

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.
@@ -1315,13 +1315,38 @@ class AuthenticationService {
1315
1315
  return this.oidc.checkAuthMultiple(url)
1316
1316
  .pipe(tap(data => {
1317
1317
  this.logger.warn(`oidc checkAuthMultiple check, response: ${JSON.stringify(data)}; looking for at least one isAuthenticated`);
1318
- if (data.some(o => o.isAuthenticated)) {
1318
+ const authenticatedConfig = data.find(o => o.isAuthenticated);
1319
+ if (authenticatedConfig && authenticatedConfig.configId) {
1320
+ this.logger.info(`User is authenticated with provider: ${authenticatedConfig.configId}. Updating Store.`);
1321
+ // first dispatch to prevent recalculate in apps service
1322
+ this.store.dispatch(AuthActions.setCurrentProvider({
1323
+ currentProvider: authenticatedConfig.configId
1324
+ }));
1325
+ // Redirect logic -> clean query params
1319
1326
  const redirect = this.cookiesService.getCookie('loginRedirectUrl');
1327
+ this.logger.info(`Correct provider dispatched, redirectUrl: ${redirect}`);
1320
1328
  if (redirect) {
1321
1329
  this.cookiesService.deleteCookie('loginRedirectUrl');
1322
- this.router.navigate([redirect]);
1330
+ this.router.navigate([redirect], { queryParams: {} });
1331
+ }
1332
+ else {
1333
+ this.router.navigate([], {
1334
+ queryParams: {},
1335
+ replaceUrl: true,
1336
+ relativeTo: this.router.routerState.root
1337
+ });
1323
1338
  }
1324
1339
  }
1340
+ else {
1341
+ this.logger.warn(`No authenticatedConfig found for ${url}`);
1342
+ }
1343
+ // if (data.some(o => o.isAuthenticated)) {
1344
+ // const redirect = this.cookiesService.getCookie('loginRedirectUrl');
1345
+ // if (redirect) {
1346
+ // this.cookiesService.deleteCookie('loginRedirectUrl');
1347
+ // this.router.navigate([redirect]);
1348
+ // }
1349
+ // }
1325
1350
  }));
1326
1351
  //}
1327
1352
  }