mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2026-09-09 18:03:21 +00:00
[MNT-25336] ADW can't start a Microsoft 365 session when using Basic … (#11238)
This commit is contained in:
@@ -33,6 +33,7 @@ export enum AppConfigValues {
|
|||||||
OAUTHCONFIG = 'oauth2',
|
OAUTHCONFIG = 'oauth2',
|
||||||
ECMHOST = 'ecmHost',
|
ECMHOST = 'ecmHost',
|
||||||
BASESHAREURL = 'baseShareUrl',
|
BASESHAREURL = 'baseShareUrl',
|
||||||
|
OOI_CONNECTOR_URL = 'ooiServiceUrl',
|
||||||
BPMHOST = 'bpmHost',
|
BPMHOST = 'bpmHost',
|
||||||
IDENTITY_HOST = 'identityHost',
|
IDENTITY_HOST = 'identityHost',
|
||||||
AUTHTYPE = 'authType',
|
AUTHTYPE = 'authType',
|
||||||
|
|||||||
@@ -1489,6 +1489,10 @@
|
|||||||
"description": "Custom url for shared links",
|
"description": "Custom url for shared links",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
},
|
},
|
||||||
|
"ooiServiceUrl": {
|
||||||
|
"description": "Custom url for ooi-service links",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
"locale": {
|
"locale": {
|
||||||
"description": "Default application locale",
|
"description": "Default application locale",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ describe('BasicAlfrescoAuthService', () => {
|
|||||||
appConfigSpy = spyOn(appConfig, 'get');
|
appConfigSpy = spyOn(appConfig, 'get');
|
||||||
appConfigSpy.withArgs(AppConfigValues.CONTEXTROOTBPM).and.returnValue('activiti-app');
|
appConfigSpy.withArgs(AppConfigValues.CONTEXTROOTBPM).and.returnValue('activiti-app');
|
||||||
appConfigSpy.withArgs(AppConfigValues.CONTEXTROOTECM).and.returnValue('alfresco');
|
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', () => {
|
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');
|
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', () => {
|
describe('login', () => {
|
||||||
let contentAuthSpy: jasmine.Spy;
|
let contentAuthSpy: jasmine.Spy;
|
||||||
let processAuthSpy: jasmine.Spy;
|
let processAuthSpy: jasmine.Spy;
|
||||||
|
|||||||
@@ -350,11 +350,11 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
|||||||
* @param requestUrl the request url
|
* @param requestUrl the request url
|
||||||
* @returns The ticket or `null` if none was found
|
* @returns The ticket or `null` if none was found
|
||||||
*/
|
*/
|
||||||
getTicketEcmBase64(requestUrl: string): string | null {
|
getTicketEcmBase64(requestUrl: string): string {
|
||||||
let ticket = null;
|
let ticket = null;
|
||||||
|
|
||||||
const bpmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM) || 'activiti-app'}/`;
|
const bpmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTBPM) || 'activiti-app'}/`;
|
||||||
const ecmRoot = `/${this.appConfig.get<string>(AppConfigValues.CONTEXTROOTECM) || 'alfresco'}/`;
|
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)) {
|
if (requestUrl?.includes(ecmRoot) && !requestUrl.includes(bpmRoot)) {
|
||||||
ticket = this.getContentServicesTicket();
|
ticket = this.getContentServicesTicket();
|
||||||
@@ -362,7 +362,10 @@ export class BasicAlfrescoAuthService extends BaseAuthenticationService {
|
|||||||
ticket = this.getProcessServicesTicket();
|
ticket = this.getProcessServicesTicket();
|
||||||
} else if (requestUrl?.includes(ecmRoot) && requestUrl.includes(bpmRoot)) {
|
} else if (requestUrl?.includes(ecmRoot) && requestUrl.includes(bpmRoot)) {
|
||||||
ticket = requestUrl.indexOf(ecmRoot) < requestUrl.indexOf(bpmRoot) ? this.getContentServicesTicket() : this.getProcessServicesTicket();
|
ticket = requestUrl.indexOf(ecmRoot) < requestUrl.indexOf(bpmRoot) ? this.getContentServicesTicket() : this.getProcessServicesTicket();
|
||||||
|
} else if (requestUrl.includes(ooiServiceRootUrl)) {
|
||||||
|
ticket = this.getContentServicesTicket();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ticket;
|
return ticket;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user