[MNT-25336] ADW can't start a Microsoft 365 session when using Basic … (#11238)

This commit is contained in:
dominikiwanekhyland
2025-10-01 14:07:27 +02:00
committed by GitHub
parent 622dcafbc4
commit dffa37f182
4 changed files with 17 additions and 2 deletions
@@ -33,6 +33,7 @@ export enum AppConfigValues {
OAUTHCONFIG = 'oauth2',
ECMHOST = 'ecmHost',
BASESHAREURL = 'baseShareUrl',
OOI_CONNECTOR_URL = 'ooiServiceUrl',
BPMHOST = 'bpmHost',
IDENTITY_HOST = 'identityHost',
AUTHTYPE = 'authType',
@@ -1489,6 +1489,10 @@
"description": "Custom url for shared links",
"type": "string"
},
"ooiServiceUrl": {
"description": "Custom url for ooi-service links",
"type": "string"
},
"locale": {
"description": "Default application locale",
"type": "string"
@@ -46,6 +46,7 @@ describe('BasicAlfrescoAuthService', () => {
appConfigSpy = spyOn(appConfig, 'get');
appConfigSpy.withArgs(AppConfigValues.CONTEXTROOTBPM).and.returnValue('activiti-app');
appConfigSpy.withArgs(AppConfigValues.CONTEXTROOTECM).and.returnValue('alfresco');
appConfigSpy.withArgs(AppConfigValues.OOI_CONNECTOR_URL).and.returnValue('ooi-service');
});
it('should return content services ticket when requestUrl contains ECM context root', () => {
@@ -70,6 +71,12 @@ describe('BasicAlfrescoAuthService', () => {
expect(ticket).toEqual('Basic Mock Process Auth ticket');
});
it('should return content services ticket when requestUrl contains OOI_SERVICE_URL context root', () => {
const ticket = basicAlfrescoAuthService.getTicketEcmBase64('http://www.example.com/ooi-service/mock-api-url');
const base64Segment = ticket.split('Basic ')[1];
expect(atob(base64Segment)).toEqual('Mock Content Auth ticket');
});
describe('login', () => {
let contentAuthSpy: jasmine.Spy;
let processAuthSpy: jasmine.Spy;
@@ -350,11 +350,11 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
* @param requestUrl the request url
* @returns The ticket or `null` if none was found
*/
getTicketEcmBase64(requestUrl: string): string | null {
getTicketEcmBase64(requestUrl: string): string {
let ticket = null;
const bpmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM) || 'activiti-app'}/`;
const ecmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM) || 'alfresco'}/`;
const ooiServiceRootUrl = `/${this.appConfig.get<string>(AppConfigValues.OOI_CONNECTOR_URL) || 'ooi-service'}/`;
if (requestUrl?.includes(ecmRoot) && !requestUrl.includes(bpmRoot)) {
ticket = this.getContentServicesTicket();
@@ -362,7 +362,10 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
ticket = this.getProcessServicesTicket();
} else if (requestUrl?.includes(ecmRoot) && requestUrl.includes(bpmRoot)) {
ticket = requestUrl.indexOf(ecmRoot) < requestUrl.indexOf(bpmRoot) ? this.getContentServicesTicket() : this.getProcessServicesTicket();
} else if (requestUrl.includes(ooiServiceRootUrl)) {
ticket = this.getContentServicesTicket();
}
return ticket;
}