import { Injectable } from '@angular/core' ; import { AuthenticationService , AppConfigService } from '@alfresco/adf-core' ; import { Observable , BehaviorSubject } from 'rxjs' ; import { SearchQueryBuilderService } from '@alfresco/adf-content-services' ; @ Injectable ( { providedIn : 'root' } ) export class AppService { private ready : BehaviorSubject < boolean > ; ready$ : Observable < boolean > ; /**
     * Whether `withCredentials` mode is enabled.
     * Usually means that `Kerberos` mode is used.
     */ get withCredentials ( ) : boolean { return this . config . get < boolean > ( 'auth.withCredentials' , false ) ; } constructor ( auth , private config , searchQueryBuilderService ) { this . ready = new BehaviorSubject ( auth . isLoggedIn ( ) || this . withCredentials ) ; this . ready$ = this . ready . asObservable ( ) ; auth . onLogin . subscribe ( ( ) => { this . ready . next ( true ) ; } ) ; auth . onLogout . subscribe ( ( ) => { searchQueryBuilderService . resetToDefaults ( ) ; } ) ; } }