[ADF-5366] initialize discovery and version compatibility service for oauth based session (#6864)

* [ADF-5366] initialize discovery and version compatibility service for oauth based session

* better error message

* * fix spaces

* * revert the search service

* * fix build

* * check properties after type update

* * check properties after type update

* * check properties after type update

* * fix infinite loop

* * fix test without title

* * wait for options

* * wait for session

* Update metadata-content-type.e2e.ts

* Update metadata-content-type.e2e.ts

* Update protractor.excludes.json

* Update protractor.excludes.json
This commit is contained in:
Dharan
2021-04-29 18:10:49 +05:30
committed by GitHub
parent c0b5935b43
commit 8b5e45f4eb
28 changed files with 532 additions and 345 deletions

View File

@@ -16,7 +16,7 @@
*/
import { Injectable } from '@angular/core';
import { Observable, from, throwError, Observer, ReplaySubject } from 'rxjs';
import { Observable, from, throwError, Observer, ReplaySubject, Subject } from 'rxjs';
import { AlfrescoApiService } from './alfresco-api.service';
import { CookieService } from './cookie.service';
import { LogService } from './log.service';
@@ -39,7 +39,19 @@ export class AuthenticationService {
private bearerExcludedUrls: string[] = ['auth/realms', 'resources/', 'assets/'];
/**
* Emits oAuth token exchange event
*/
onTokenExchange: Subject<string> = new Subject<string>();
/**
* Emits Basic auth login event
*/
onLogin: ReplaySubject<any> = new ReplaySubject<any>(1);
/**
* Emits logout event
*/
onLogout: ReplaySubject<any> = new ReplaySubject<any>(1);
constructor(
@@ -48,6 +60,15 @@ export class AuthenticationService {
private alfrescoApi: AlfrescoApiService,
private cookie: CookieService,
private logService: LogService) {
this.listenForOauthTokenExchange();
}
private listenForOauthTokenExchange() {
this.alfrescoApi.alfrescoApiInitialized.subscribe(() => {
this.alfrescoApi.getInstance().oauth2Auth?.on('token_issued', () => {
this.onTokenExchange.next(this.alfrescoApi.getInstance().oauth2Auth.token);
});
});
}
/**