diff --git a/src/app/core/services/auth.service.ts b/src/app/core/services/auth.service.ts index 074e4d732..09f73bbb8 100644 --- a/src/app/core/services/auth.service.ts +++ b/src/app/core/services/auth.service.ts @@ -41,8 +41,14 @@ export class AuthService { } this.loaderService.show(); - const loginUrl = `${this.casUrl}/login?${urlParam({ service: `${this.webUrl}/login`, next: window.location.href })}`; - window.location.href = loginUrl; + + const serviceUrl = new URL(`${this.webUrl}/login`); + serviceUrl.searchParams.set('next', window.location.href); + + const loginUrl = new URL(`${this.casUrl}/login`); + loginUrl.searchParams.set('service', serviceUrl.toString()); + + window.location.href = loginUrl.toString(); } navigateToOrcidSignIn(): void { @@ -79,7 +85,7 @@ export class AuthService { if (isPlatformBrowser(this.platformId)) { this.cookieService.deleteAll(); - window.location.href = `${this.webUrl}/logout/?next=${encodeURIComponent(nextUrl || '/')}`; + window.location.href = `${this.webUrl}/logout/?next=${encodeURIComponent(nextUrl || `${window.location.origin}/`)}`; } } diff --git a/src/app/features/profile/components/profile-information/profile-information.component.spec.ts b/src/app/features/profile/components/profile-information/profile-information.component.spec.ts index 947edf462..f8ec5857e 100644 --- a/src/app/features/profile/components/profile-information/profile-information.component.spec.ts +++ b/src/app/features/profile/components/profile-information/profile-information.component.spec.ts @@ -37,6 +37,7 @@ describe('ProfileInformationComponent', () => { }, institutionalRequestAccessEnabled: true, logoPath: 'logo.png', + sso_availability: 'Public', }, ]; diff --git a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts index 2bf6f7d49..5b037e8f7 100644 --- a/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts +++ b/src/app/features/project/overview/components/add-component-dialog/add-component-dialog.component.spec.ts @@ -64,6 +64,7 @@ describe('AddComponentDialogComponent', () => { assets: { logo: '', logo_rounded: '', banner: '' }, institutionalRequestAccessEnabled: false, logoPath: '', + sso_availability: 'Public', }, { id: 'inst-2', @@ -76,6 +77,7 @@ describe('AddComponentDialogComponent', () => { assets: { logo: '', logo_rounded: '', banner: '' }, institutionalRequestAccessEnabled: false, logoPath: '', + sso_availability: 'Public', }, ]; @@ -91,6 +93,7 @@ describe('AddComponentDialogComponent', () => { assets: { logo: '', logo_rounded: '', banner: '' }, institutionalRequestAccessEnabled: false, logoPath: '', + sso_availability: 'Public', }, ]; diff --git a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts index 836088967..1897a7660 100644 --- a/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts +++ b/src/app/shared/components/affiliated-institution-select/affiliated-institution-select.component.spec.ts @@ -68,6 +68,7 @@ describe('AffiliatedInstitutionSelectComponent', () => { }, institutionalRequestAccessEnabled: false, logoPath: '/logos/unavailable.png', + sso_availability: 'Unavailable', }; fixture.componentRef.setInput('institutions', mockInstitutions); @@ -134,6 +135,7 @@ describe('AffiliatedInstitutionSelectComponent', () => { }, institutionalRequestAccessEnabled: false, logoPath: '/logos/unavailable.png', + sso_availability: 'Unavailable', }; fixture.componentRef.setInput('institutions', mockInstitutions); @@ -181,6 +183,7 @@ describe('AffiliatedInstitutionSelectComponent', () => { }, institutionalRequestAccessEnabled: false, logoPath: '/logos/unavailable.png', + sso_availability: 'Unavailable', }; fixture.componentRef.setInput('institutions', mockInstitutions); diff --git a/src/app/shared/mappers/institutions/institutions.mapper.ts b/src/app/shared/mappers/institutions/institutions.mapper.ts index f3552702a..172faacf8 100644 --- a/src/app/shared/mappers/institutions/institutions.mapper.ts +++ b/src/app/shared/mappers/institutions/institutions.mapper.ts @@ -25,6 +25,7 @@ export class InstitutionsMapper { logoPath: data.attributes.logo_path, userMetricsUrl: data.relationships?.user_metrics?.links?.related?.href, linkToExternalReportsArchive: data.attributes.link_to_external_reports_archive, + sso_availability: data.attributes.sso_availability, }; } diff --git a/src/app/shared/models/institutions/institution-json-api.model.ts b/src/app/shared/models/institutions/institution-json-api.model.ts index cedc24e36..63a7f7a3c 100644 --- a/src/app/shared/models/institutions/institution-json-api.model.ts +++ b/src/app/shared/models/institutions/institution-json-api.model.ts @@ -23,6 +23,7 @@ interface InstitutionAttributesJsonApi { institutional_request_access_enabled: boolean; logo_path: string; link_to_external_reports_archive: string; + sso_availability: string; } interface InstitutionLinksJsonApi { diff --git a/src/app/shared/models/institutions/institutions.model.ts b/src/app/shared/models/institutions/institutions.model.ts index f00b4a278..aaee35b7d 100644 --- a/src/app/shared/models/institutions/institutions.model.ts +++ b/src/app/shared/models/institutions/institutions.model.ts @@ -16,6 +16,7 @@ export interface Institution { logoPath: string; userMetricsUrl?: string; linkToExternalReportsArchive?: string; + sso_availability: string; } export interface InstitutionAssets { diff --git a/src/testing/mocks/institution.mock.ts b/src/testing/mocks/institution.mock.ts index fa918fabd..390852767 100644 --- a/src/testing/mocks/institution.mock.ts +++ b/src/testing/mocks/institution.mock.ts @@ -13,4 +13,5 @@ export const MOCK_INSTITUTION = { }, institutionalRequestAccessEnabled: true, logoPath: 'https://mockinstitution.org/logo.png', + sso_availability: 'Public', };