diff --git a/lib/core/app-config/app-config.service.ts b/lib/core/app-config/app-config.service.ts
index d2622a1f0c..4559f2ad45 100644
--- a/lib/core/app-config/app-config.service.ts
+++ b/lib/core/app-config/app-config.service.ts
@@ -29,6 +29,7 @@ export enum AppConfigValues {
ECMHOST = 'ecmHost',
BASESHAREURL = 'baseShareUrl',
BPMHOST = 'bpmHost',
+ IDENTITY_HOST = 'identityHost',
AUTHTYPE = 'authType',
CONTEXTROOTECM = 'contextRootEcm',
CONTEXTROOTBPM = 'contextRootBpm',
diff --git a/lib/core/settings/host-settings.component.html b/lib/core/settings/host-settings.component.html
index 393fc98a5a..daa9b4c3ef 100644
--- a/lib/core/settings/host-settings.component.html
+++ b/lib/core/settings/host-settings.component.html
@@ -53,6 +53,17 @@
{{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
+
+ Identity Host
+
+
+ {{ 'CORE.HOST_SETTINGS.NOT_VALID'| translate }}
+
+
+ {{ 'CORE.HOST_SETTINGS.REQUIRED'| translate }}
+
+
diff --git a/lib/core/settings/host-settings.component.spec.ts b/lib/core/settings/host-settings.component.spec.ts
index 358a491eef..629d9b08f5 100644
--- a/lib/core/settings/host-settings.component.spec.ts
+++ b/lib/core/settings/host-settings.component.spec.ts
@@ -99,6 +99,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'BPM';
+ appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -152,6 +153,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'ECM';
+ appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -200,6 +202,7 @@ describe('HostSettingsComponent', () => {
beforeEach(() => {
appConfigService.config.providers = 'ALL';
+ appConfigService.config.authType = 'BASIC';
appConfigService.load();
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
@@ -270,10 +273,12 @@ describe('HostSettingsComponent', () => {
let bpmUrlInput;
let ecmUrlInput;
+ let identityUrlInput;
let oauthHostUrlInput;
let clientIdInput;
beforeEach(() => {
+ appConfigService.config.identityHost = 'http://localhost:123';
appConfigService.config.providers = 'ALL';
appConfigService.config.authType = 'OAUTH';
appConfigService.config.oauth2 = {
@@ -289,6 +294,7 @@ describe('HostSettingsComponent', () => {
fixture.detectChanges();
bpmUrlInput = element.querySelector('#bpmHost');
ecmUrlInput = element.querySelector('#ecmHost');
+ identityUrlInput = element.querySelector('#identityHost');
oauthHostUrlInput = element.querySelector('#oauthHost');
clientIdInput = element.querySelector('#clientId');
});
@@ -300,6 +306,7 @@ describe('HostSettingsComponent', () => {
it('should have a valid form when the urls are correct', (done) => {
const urlBpm = 'http://localhost:9999/bpm';
const urlEcm = 'http://localhost:9999/bpm';
+ const urlIdentity = 'http://localhost:9999/identity';
component.form.statusChanges.subscribe((status: string) => {
expect(status).toEqual('VALID');
@@ -311,6 +318,9 @@ describe('HostSettingsComponent', () => {
bpmUrlInput.value = urlBpm;
bpmUrlInput.dispatchEvent(new Event('input'));
+
+ identityUrlInput.value = urlIdentity;
+ identityUrlInput.dispatchEvent(new Event('input'));
});
it('should have an invalid form when the url inserted is wrong', (done) => {
@@ -326,6 +336,19 @@ describe('HostSettingsComponent', () => {
bpmUrlInput.dispatchEvent(new Event('input'));
});
+ it('should have an invalid form when the identity url inserted is wrong', (done) => {
+ const url = 'wrong';
+
+ component.form.statusChanges.subscribe((status: string) => {
+ expect(status).toEqual('INVALID');
+ expect(component.identityHost.hasError('pattern')).toBeTruthy();
+ done();
+ });
+
+ identityUrlInput.value = url;
+ identityUrlInput.dispatchEvent(new Event('input'));
+ });
+
it('should have an invalid form when the host is wrong', (done) => {
const hostUrl = 'wrong';
diff --git a/lib/core/settings/host-settings.component.ts b/lib/core/settings/host-settings.component.ts
index f1a86faf4d..27e1a04b66 100644
--- a/lib/core/settings/host-settings.component.ts
+++ b/lib/core/settings/host-settings.component.ts
@@ -43,6 +43,7 @@ export class HostSettingsComponent implements OnInit {
providers: string[] = ['BPM', 'ECM', 'ALL'];
showSelectProviders = true;
+ hasIdentity = false;
form: FormGroup;
@@ -101,11 +102,14 @@ export class HostSettingsComponent implements OnInit {
private removeFormGroups() {
this.form.removeControl('bpmHost');
this.form.removeControl('ecmHost');
+ this.form.removeControl('identityHost');
+ this.hasIdentity = false;
}
private addFormGroups() {
this.addBPMFormControl();
this.addECMFormControl();
+ this.addIdentityHostFormControl();
}
private addOAuthFormGroup() {
@@ -120,6 +124,14 @@ export class HostSettingsComponent implements OnInit {
}
}
+ private addIdentityHostFormControl() {
+ if ((this.isOAUTH()) && !this.identityHost) {
+ const identityHostFormControl = this.createIdentityFormControl();
+ this.form.addControl('identityHost', identityHostFormControl);
+ this.hasIdentity = true;
+ }
+ }
+
private addECMFormControl() {
if ((this.isECM() || this.isALL()) && !this.ecmHost) {
const ecmFormControl = this.createECMFormControl();
@@ -146,6 +158,10 @@ export class HostSettingsComponent implements OnInit {
return new FormControl(this.appConfig.get(AppConfigValues.BPMHOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
}
+ private createIdentityFormControl(): AbstractControl {
+ return new FormControl(this.appConfig.get(AppConfigValues.IDENTITY_HOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
+ }
+
private createECMFormControl(): AbstractControl {
return new FormControl(this.appConfig.get(AppConfigValues.ECMHOST), [Validators.required, Validators.pattern(this.HOST_REGEX)]);
}
@@ -179,6 +195,7 @@ export class HostSettingsComponent implements OnInit {
private saveOAuthValues(values: any) {
this.storageService.setItem(AppConfigValues.OAUTHCONFIG, JSON.stringify(values.oauthConfig));
+ this.storageService.setItem(AppConfigValues.IDENTITY_HOST, values.identityHost);
}
private saveBPMValues(values: any) {
@@ -221,6 +238,10 @@ export class HostSettingsComponent implements OnInit {
return this.oauthConfig.get('host');
}
+ get identityHost(): AbstractControl {
+ return this.form.get('identityHost');
+ }
+
get clientId(): AbstractControl {
return this.oauthConfig.get('clientId');
}