Skip to content
This repository has been archived by the owner on Feb 8, 2024. It is now read-only.

Commit

Permalink
[MNT-23143] Add withCredentials to isLoggedIn
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalKinas committed Nov 24, 2022
1 parent 80106a4 commit 90ab51c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/alfrescoApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -452,9 +452,9 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
if (this.isBpmConfiguration()) {
return this.processAuth.isLoggedIn();
} else if (this.isEcmConfiguration()) {
return this.contentAuth.isLoggedIn();
return this.config.withCredentials ? true : this.contentAuth.isLoggedIn();
} else if (this.isEcmBpmConfiguration()) {
return this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn();
return this.config.withCredentials ? true : (this.contentAuth.isLoggedIn() && this.processAuth.isLoggedIn());
} else {
return false;
}
Expand Down
22 changes: 22 additions & 0 deletions test/alfrescoApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,28 @@ describe('Basic configuration test', () => {
expect(alfrescoJsApi.isEcmLoggedIn()).equal(true);
});

it('should withCredentials true parameter with hostEcm should be reflected in isLoggedIn', () => {
const hostEcm = 'http://127.0.0.1:8080';
const alfrescoJsApi = new AlfrescoApi({
hostEcm,
provider: 'ECM',
withCredentials: true
} as AlfrescoApiConfig);

expect(alfrescoJsApi.isLoggedIn()).equal(true);
});

it('should withCredentials true parameter with ALL provider should be reflected in isLoggedIn', () => {
const hostEcm = 'http://127.0.0.1:8080';
const alfrescoJsApi = new AlfrescoApi({
hostEcm,
provider: 'ALL',
withCredentials: true
} as AlfrescoApiConfig);

expect(alfrescoJsApi.isLoggedIn()).equal(true);
});

it('should withCredentials false parameter should be reflected in the clients', () => {
const config = {
hostEcm: 'http://testServer.com:1616',
Expand Down

0 comments on commit 90ab51c

Please sign in to comment.