mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[AAE-12501] Trigger on login when token is received
This commit is contained in:
@@ -20,7 +20,7 @@ import { from, Observable, throwError, Subject } from 'rxjs';
|
||||
import { catchError, map, switchMap, filter, take } from 'rxjs/operators';
|
||||
import { RepositoryInfo, SystemPropertiesRepresentation } from '@alfresco/js-api';
|
||||
|
||||
import { BpmProductVersionModel, AlfrescoApiService, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { BpmProductVersionModel, AuthenticationService } from '@alfresco/adf-core';
|
||||
import { ApiClientsService } from '@alfresco/adf-core/api';
|
||||
|
||||
@Injectable({
|
||||
@@ -34,13 +34,12 @@ export class DiscoveryApiService {
|
||||
ecmProductInfo$ = new Subject<RepositoryInfo>();
|
||||
|
||||
constructor(
|
||||
private apiService: AlfrescoApiService,
|
||||
private authenticationService: AuthenticationService,
|
||||
private apiClientsService: ApiClientsService
|
||||
) {
|
||||
this.authenticationService.onLogin
|
||||
.pipe(
|
||||
filter(() => this.apiService.getInstance()?.isEcmLoggedIn()),
|
||||
filter(() => this.authenticationService.isEcmLoggedIn()),
|
||||
take(1),
|
||||
switchMap(() => this.getEcmProductInfo())
|
||||
)
|
||||
|
||||
@@ -46,6 +46,13 @@ export class OIDCAuthenticationService extends BaseAuthenticationService {
|
||||
private readonly auth: AuthService
|
||||
) {
|
||||
super(alfrescoApi, appConfig, cookie, logService);
|
||||
this.alfrescoApi.alfrescoApiInitialized.subscribe(() => {
|
||||
this.oauthService.events.pipe(
|
||||
filter((event)=> event.type === 'token_received')
|
||||
).subscribe(()=>{
|
||||
this.onLogin.next();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
isEcmLoggedIn(): boolean {
|
||||
|
||||
Reference in New Issue
Block a user