mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
fix
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import { HttpClient } from '@angular/common/http';
|
||||
import { Injectable } from '@angular/core';
|
||||
import { ObjectUtils } from '../common/utils/object-utils';
|
||||
import { Observable, Subject } from 'rxjs';
|
||||
import { Observable, ReplaySubject } from 'rxjs';
|
||||
import { map, distinctUntilChanged, take } from 'rxjs/operators';
|
||||
import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions';
|
||||
import { OpenidConfiguration } from '../auth/interfaces/openid-configuration.interface';
|
||||
@@ -72,7 +72,7 @@ export class AppConfigService {
|
||||
};
|
||||
|
||||
status: Status = Status.INIT;
|
||||
protected onLoadSubject: Subject<any>;
|
||||
protected onLoadSubject: ReplaySubject<any>;
|
||||
onLoad: Observable<any>;
|
||||
|
||||
get isLoaded() {
|
||||
@@ -80,7 +80,7 @@ export class AppConfigService {
|
||||
}
|
||||
|
||||
constructor(protected http: HttpClient, protected extensionService: ExtensionService) {
|
||||
this.onLoadSubject = new Subject();
|
||||
this.onLoadSubject = new ReplaySubject();
|
||||
this.onLoad = this.onLoadSubject.asObservable();
|
||||
|
||||
extensionService.setup$.subscribe((config) => {
|
||||
|
||||
@@ -99,16 +99,17 @@ export class OidcAuthenticationService extends BaseAuthenticationService {
|
||||
}
|
||||
|
||||
loginWithPassword(username: string, password: string): Observable<{ type: string; ticket: any }> {
|
||||
// @ts-ignore
|
||||
return defer(async () => {
|
||||
try {
|
||||
await this.authConfig.loadConfig();
|
||||
await this.oauthService.loadDiscoveryDocument();
|
||||
await this.oauthService.fetchTokenUsingPasswordFlowAndLoadUserProfile(username, password);
|
||||
await this.oauthService.refreshToken();
|
||||
const accessToken = this.oauthService.getAccessToken();
|
||||
this.onLogin.next(accessToken);
|
||||
|
||||
return {
|
||||
type: this.appConfig.get(AppConfigValues.PROVIDERS),
|
||||
type: <string>this.appConfig.get(AppConfigValues.PROVIDERS),
|
||||
ticket: accessToken
|
||||
};
|
||||
} catch (err) {
|
||||
|
||||
@@ -37,14 +37,9 @@ export class CoreAutomationService {
|
||||
private storageService: StorageService,
|
||||
private auth: AuthenticationService
|
||||
) {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('ADF Core AutomationService init');
|
||||
}
|
||||
|
||||
setup() {
|
||||
// eslint-disable-next-line no-console
|
||||
console.log('ADF Core setup');
|
||||
|
||||
const adfProxy = window['adf'] || {};
|
||||
|
||||
adfProxy.getConfigField = (field: string): any => this.appConfigService.get(field);
|
||||
|
||||
Reference in New Issue
Block a user