Skip to content
This repository was archived by the owner on Jun 11, 2025. It is now read-only.

Commit 5dae4de

Browse files
authored
Merge pull request #1458 from Alfresco/bugfix/dev-mkinas-MNT-23143-allow-discoveryService-withCredentials
[MNT-23143] withCredentials reflected in isBpmLoggedIn
2 parents 4517866 + 90ab51c commit 5dae4de

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

src/alfrescoApi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -452,9 +452,9 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
452452
if (this.isBpmConfiguration()) {
453453
return this.processAuth.isLoggedIn();
454454
} else if (this.isEcmConfiguration()) {
455-
return this.contentAuth.isLoggedIn();
455+
return this.config.withCredentials ? true : this.contentAuth.isLoggedIn();
456456
} else if (this.isEcmBpmConfiguration()) {
457-
return this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn();
457+
return this.config.withCredentials ? true : (this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn());
458458
} else {
459459
return false;
460460
}
@@ -477,7 +477,7 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
477477
if (this.isOauthConfiguration()) {
478478
return this.oauth2Auth.isLoggedIn();
479479
} else {
480-
return this.contentAuth.isLoggedIn();
480+
return this.config.withCredentials ? true : this.contentAuth.isLoggedIn();
481481
}
482482
}
483483
return false;

test/alfrescoApi.spec.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,39 @@ describe('Basic configuration test', () => {
9696
expect(alfrescoJsApi.processClient.isWithCredentials()).equal(true);
9797
});
9898

99+
it('should withCredentials true parameter with hostEcm should be reflected in isEcmLoggedIn', () => {
100+
const hostEcm = 'http://127.0.0.1:8080';
101+
const alfrescoJsApi = new AlfrescoApi({
102+
hostEcm,
103+
provider: 'ECM',
104+
withCredentials: true
105+
} as AlfrescoApiConfig);
106+
107+
expect(alfrescoJsApi.isEcmLoggedIn()).equal(true);
108+
});
109+
110+
it('should withCredentials true parameter with hostEcm should be reflected in isLoggedIn', () => {
111+
const hostEcm = 'http://127.0.0.1:8080';
112+
const alfrescoJsApi = new AlfrescoApi({
113+
hostEcm,
114+
provider: 'ECM',
115+
withCredentials: true
116+
} as AlfrescoApiConfig);
117+
118+
expect(alfrescoJsApi.isLoggedIn()).equal(true);
119+
});
120+
121+
it('should withCredentials true parameter with ALL provider should be reflected in isLoggedIn', () => {
122+
const hostEcm = 'http://127.0.0.1:8080';
123+
const alfrescoJsApi = new AlfrescoApi({
124+
hostEcm,
125+
provider: 'ALL',
126+
withCredentials: true
127+
} as AlfrescoApiConfig);
128+
129+
expect(alfrescoJsApi.isLoggedIn()).equal(true);
130+
});
131+
99132
it('should withCredentials false parameter should be reflected in the clients', () => {
100133
const config = {
101134
hostEcm: 'http://testServer.com:1616',

0 commit comments

Comments
 (0)