Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ describe('BasicAlfrescoAuthService', () => {
expect(ticket).toEqual('Basic Mock Process Auth ticket');
});

it('should return content services ticket when requestUrl does not contain ECM or BPM context root', () => {
const ticket = basicAlfrescoAuthService.getTicketEcmBase64('http://www.example.com/ooi-services');
const base64Segment = ticket.split('Basic ')[1];
expect(atob(base64Segment)).toEqual('Mock Content Auth ticket');
});

describe('login', () => {
let contentAuthSpy: jasmine.Spy;
let processAuthSpy: jasmine.Spy;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -351,19 +351,18 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
* @returns The ticket or `null` if none was found
*/
getTicketEcmBase64(requestUrl: string): string | null {
let ticket = null;

const bpmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM) || 'activiti-app'}/`;
const ecmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM) || 'alfresco'}/`;

if (requestUrl?.includes(ecmRoot) && !requestUrl.includes(bpmRoot)) {
ticket = this.getContentServicesTicket();
return this.getContentServicesTicket();
} else if (requestUrl?.includes(bpmRoot) && !requestUrl.includes(ecmRoot)) {
ticket = this.getProcessServicesTicket();
return this.getProcessServicesTicket();
} else if (requestUrl?.includes(ecmRoot) && requestUrl.includes(bpmRoot)) {
ticket = requestUrl.indexOf(ecmRoot) < requestUrl.indexOf(bpmRoot) ? this.getContentServicesTicket() : this.getProcessServicesTicket();
return requestUrl.indexOf(ecmRoot) < requestUrl.indexOf(bpmRoot) ? this.getContentServicesTicket() : this.getProcessServicesTicket();
} else {
return this.getContentServicesTicket();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm just thinking if that's the right solution, in that case every request outside ecmRoot or bpmRoot will receive content services ticket and I don't really think we want to do this, I wonder if this wouldn't be safer to rather add additional case for OOI connector rather then add it to every other request, @AleksanderSklorz what do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, good point Michał. I agree with you that it will be safer, especially that in previous version we returned null for that case so we don't know what consequences this will cause if now we will be always that in this case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@AleksanderSklorz @MichalKinas I thought it will be cleaner not to implement any login required for OOI Connector into ADF, but sure, I have updated my PR after your comments. THanks :)

}
return ticket;
}

private getProcessServicesTicket(): string {
Expand Down
Loading