@@ -26,10 +26,11 @@ import { AuthService } from '../../app/core/auth/auth.service';
2626import { ThemeService } from '../../app/shared/theme-support/theme.service' ;
2727import { StoreAction , StoreActionTypes } from '../../app/store.actions' ;
2828import { coreSelector } from '../../app/core/core.selectors' ;
29- import { find , map } from 'rxjs/operators' ;
29+ import { filter , find , map , switchMap } from 'rxjs/operators' ;
3030import { isNotEmpty } from '../../app/shared/empty.util' ;
3131import { logStartupMessage } from '../../../startup-message' ;
3232import { MenuService } from '../../app/shared/menu/menu.service' ;
33+ import { RootDataService } from '../../app/core/data/root-data.service' ;
3334
3435/**
3536 * Performs client-side initialization.
@@ -51,6 +52,7 @@ export class BrowserInitService extends InitService {
5152 protected authService : AuthService ,
5253 protected themeService : ThemeService ,
5354 protected menuService : MenuService ,
55+ private rootDatatService : RootDataService
5456 ) {
5557 super (
5658 store ,
@@ -80,6 +82,7 @@ export class BrowserInitService extends InitService {
8082 return async ( ) => {
8183 await this . loadAppState ( ) ;
8284 this . checkAuthenticationToken ( ) ;
85+ this . externalAuthCheck ( ) ;
8386 this . initCorrelationId ( ) ;
8487
8588 this . checkEnvironment ( ) ;
@@ -134,4 +137,24 @@ export class BrowserInitService extends InitService {
134137 protected initGoogleAnalytics ( ) {
135138 this . googleAnalyticsService . addTrackingIdToPage ( ) ;
136139 }
140+
141+ /**
142+ * When authenticated during the external authentication flow invalidate
143+ * the cache so the app is rehydrated with fresh data.
144+ * @private
145+ */
146+ private externalAuthCheck ( ) {
147+
148+ this . authenticationReady$ ( ) . pipe (
149+ switchMap ( ( ) => this . authService . isExternalAuthentication ( ) . pipe (
150+ filter ( ( externalAuth : boolean ) => externalAuth )
151+ ) )
152+ ) . subscribe ( ( ) => {
153+ this . authService . setExternalAuthStatus ( false ) ;
154+ this . rootDatatService . invalidateRootCache ( ) ;
155+ }
156+ ) ;
157+
158+ }
159+
137160}
0 commit comments