[AAE-8639] Discovery OpenId - Load discovery and pass info to jsapi (#7632)

* Load discovery and pass info to jsapi

* fix the roles empty scenario tests

* Make lint happier

* Rename the initApi method

* Add secret field

Co-authored-by: arditdomi <ardit.domi@hyland.com>
This commit is contained in:
Maurizio Vitale
2022-05-13 19:03:06 +01:00
committed by GitHub
parent 6fb1bda6a9
commit cec9297e14
10 changed files with 145 additions and 21 deletions

View File

@@ -21,6 +21,7 @@ import { ObjectUtils } from '../utils/object-utils';
import { Observable, Subject } from 'rxjs';
import { map, distinctUntilChanged, take } from 'rxjs/operators';
import { ExtensionConfig, ExtensionService, mergeObjects } from '@alfresco/adf-extensions';
import { OpenidConfiguration } from '../services/openid-configuration.interface';
/* spellchecker: disable */
// eslint-disable-next-line no-shadow
@@ -208,6 +209,26 @@ export class AppConfigService {
});
}
/**
* Call the discovery API to fetch configuration
*
* @returns Discovery configuration
*/
loadWellKnown(hostIdp: string): Promise<OpenidConfiguration> {
return new Promise(async (resolve, reject) => {
this.http
.get<OpenidConfiguration>(`${hostIdp}/.well-known/openid-configuration`)
.subscribe({
next: (res: OpenidConfiguration) => {
resolve(res);
},
error: (err: any) => {
reject(err);
}
});
});
}
private formatString(str: string, keywords: Map<string, string>): string {
let result = str;