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

Commit

Permalink
Merge pull request #1458 from Alfresco/bugfix/dev-mkinas-MNT-23143-al…
Browse files Browse the repository at this point in the history
…low-discoveryService-withCredentials

[MNT-23143] withCredentials reflected in isBpmLoggedIn
  • Loading branch information
MichalKinas committed Nov 24, 2022
2 parents 4517866 + 90ab51c commit 5dae4de
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
6 changes: 3 additions & 3 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 All @@ -477,7 +477,7 @@ export class AlfrescoApi implements Emitter, AlfrescoApiType {
if (this.isOauthConfiguration()) {
return this.oauth2Auth.isLoggedIn();
} else {
return this.contentAuth.isLoggedIn();
return this.config.withCredentials ? true : this.contentAuth.isLoggedIn();
}
}
return false;
Expand Down
33 changes: 33 additions & 0 deletions test/alfrescoApi.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,39 @@ describe('Basic configuration test', () => {
expect(alfrescoJsApi.processClient.isWithCredentials()).equal(true);
});

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

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 5dae4de

Please sign in to comment.