From 8bcbea3963e4c6f0316c5e4adfef7c7bf05f64f5 Mon Sep 17 00:00:00 2001 From: Fabian Bedarf Date: Mon, 13 Feb 2023 15:56:25 +0100 Subject: [PATCH 1/4] ftr: reactived isFromSender after be update TRACEFOSS-939 --- .../core/investigation-helper.service.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/modules/page/investigations/core/investigation-helper.service.ts b/src/app/modules/page/investigations/core/investigation-helper.service.ts index c4ee2bf4e4..f54722e98e 100644 --- a/src/app/modules/page/investigations/core/investigation-helper.service.ts +++ b/src/app/modules/page/investigations/core/investigation-helper.service.ts @@ -56,24 +56,24 @@ export class InvestigationHelperService { } public showApproveButton({ status, isFromSender } = {} as Notification): boolean { - return /*isFromSender &&*/ status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor(); + return isFromSender && status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor(); } public showCancelButton({ status, isFromSender } = {} as Notification): boolean { - return /*isFromSender &&*/ status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor(); + return isFromSender && status === NotificationStatus.CREATED && this.roleService.isAtLeastSupervisor(); } public showCloseButton({ status, isFromSender } = {} as Notification): boolean { const disallowedStatus = [NotificationStatus.CREATED, NotificationStatus.CLOSED, NotificationStatus.CANCELED]; - return /*isFromSender &&*/ !disallowedStatus.includes(status) && this.roleService.isAtLeastSupervisor(); + return isFromSender && !disallowedStatus.includes(status) && this.roleService.isAtLeastSupervisor(); } public showAcknowledgeButton({ status, isFromSender } = {} as Notification): boolean { - return /*!isFromSender &&*/ status === NotificationStatus.RECEIVED && this.roleService.isAtLeastSupervisor(); + return !isFromSender && status === NotificationStatus.RECEIVED && this.roleService.isAtLeastSupervisor(); } public showAcceptButton({ status, isFromSender } = {} as Notification): boolean { - return /*!isFromSender &&*/ status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor(); + return !isFromSender && status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor(); } public showDeclineButton({ status, isFromSender } = {} as Notification): boolean { - return /*!isFromSender &&*/ status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor(); + return !isFromSender && status === NotificationStatus.ACKNOWLEDGED && this.roleService.isAtLeastSupervisor(); } } From a3ec61b1962cd7db71b0cff988e27aa3be4e6774 Mon Sep 17 00:00:00 2001 From: Fabian Bedarf Date: Mon, 13 Feb 2023 16:27:02 +0100 Subject: [PATCH 2/4] ftr: add scripts to run fe locally against be TRACEFOSS-939 --- angular.json | 11 +++++++ package.json | 2 ++ src/environments/environment.localBackend.ts | 2 +- .../environment.localBackendNoAuth.ts | 29 +++++++++++++++++++ 4 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 src/environments/environment.localBackendNoAuth.ts diff --git a/angular.json b/angular.json index 81c40f652a..8b59dfe1d0 100644 --- a/angular.json +++ b/angular.json @@ -99,6 +99,14 @@ } ] }, + "localBackendNoAuth": { + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.localBackendNoAuth.ts" + } + ] + }, "production": { "fileReplacements": [ { @@ -154,6 +162,9 @@ "localBackend": { "browserTarget": "trace-x:build:dev,localBackend" }, + "localBackendNoAuth": { + "browserTarget": "trace-x:build:dev,localBackendNoAuth" + }, "production": { "browserTarget": "trace-x:build:production" }, diff --git a/package.json b/package.json index 159df85500..a6940b5d7d 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,8 @@ "start:auth": "ng serve --configuration=dev,auth", "start:auth:mock": "ng serve --configuration=authMock", "start:auth:local": "ng serve --configuration=authLocal", + "start:auth:localBe": "ng serve --configuration=localBackend", + "start:noAuth:localBe": "ng serve --configuration=localBackendNoAuth", "env:mock": "docker-compose up", "test": "ng test", "test:ci": "ng test --no-watch --no-progress --browsers=ChromeHeadless", diff --git a/src/environments/environment.localBackend.ts b/src/environments/environment.localBackend.ts index e741fb2c70..bb4c210e89 100644 --- a/src/environments/environment.localBackend.ts +++ b/src/environments/environment.localBackend.ts @@ -27,7 +27,7 @@ export const environment = { authDisabled: false, mockService: false, keycloakUrl: 'https://centralidp.dev.demo.catena-x.net/auth', - clientId: 'Cl10-CX-Part', + clientId: 'Cl17-CX-Part', defaultRealm: 'CX-Central', apiUrl: 'http://localhost:8080/api', }; diff --git a/src/environments/environment.localBackendNoAuth.ts b/src/environments/environment.localBackendNoAuth.ts new file mode 100644 index 0000000000..aa9cdb647d --- /dev/null +++ b/src/environments/environment.localBackendNoAuth.ts @@ -0,0 +1,29 @@ +/******************************************************************************** + * Copyright (c) 2022, 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) + * Copyright (c) 2022, 2023 ZF Friedrichshafen AG + * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License, Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0. + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT + * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + * License for the specific language governing permissions and limitations + * under the License. + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +import { _environment } from './_environment.base'; + +export const environment = { + ..._environment, + authDisabled: true, + mockService: false, + apiUrl: 'http://localhost:8080/api', +}; From b749b96f89c45594be85272b815b25b64d4b318c Mon Sep 17 00:00:00 2001 From: Fabian Bedarf Date: Wed, 15 Feb 2023 10:14:21 +0100 Subject: [PATCH 3/4] ftr: remove traces of realm usage bc not allowed by cx TRACEFOSS-xxx --- INSTALL.md | 12 +----- .../templates/deployment.yaml | 2 - .../values-dev-test.yaml | 2 - .../values-dev.yaml | 2 - .../values-int-test.yaml | 2 - .../values-int.yaml | 2 - .../values-pen.yaml | 2 - .../values-pre-prod.yaml | 2 - docs/authentication.md | 38 ++++--------------- docs/configuration.md | 9 ----- scripts/inject-dynamic-env.js | 2 - .../core/api/api.service.properties.ts | 28 -------------- src/app/modules/core/core.routing.ts | 6 --- .../layout/nav-bar/nav-bar.component.html | 4 +- .../core/layout/nav-bar/nav-bar.component.ts | 6 +-- src/app/modules/core/user/role.guard.ts | 3 +- src/app/modules/page/about/about-route.ts | 3 +- src/app/modules/page/admin/admin-route.ts | 3 +- .../modules/page/dashboard/dashboard-route.ts | 3 +- .../investigations-external-route.ts | 3 +- .../investigations.component.spec.ts | 2 +- .../page/other-parts/other-parts-route.ts | 3 +- src/app/modules/page/parts/parts-route.ts | 3 +- .../shared/abstraction/layout-facade.ts | 2 +- .../presentation/part-detail.component.ts | 3 +- src/environments/_environment.base.ts | 6 +-- src/environments/environment.auth.ts | 1 - src/environments/environment.authLocal.ts | 1 - src/environments/environment.authMock.ts | 2 - src/environments/environment.dev.ts | 1 - src/environments/environment.localBackend.ts | 2 - src/environments/environment.production.ts | 6 +-- 32 files changed, 28 insertions(+), 138 deletions(-) delete mode 100644 src/app/modules/core/api/api.service.properties.ts diff --git a/INSTALL.md b/INSTALL.md index f171e3b0b2..2f5164f426 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -6,8 +6,6 @@ Support environment variables are: const ENV_VARS_MAPPING = { CATENAX_PORTAL_KEYCLOAK_URL: 'keycloakUrl', CATENAX_PORTAL_CLIENT_ID: 'clientId', - CATENAX_PORTAL_DEFAULT_REALM: 'defaultRealm', - CATENAX_PORTAL_REALM_LOGO: 'realmLogo', CATENAX_PORTAL_API_URL: 'apiUrl', CATENAX_PORTAL_BASE_URL: 'baseUrl', }; @@ -19,12 +17,6 @@ This variable is used to set up and use keycloak `CATENAX_PORTAL_CLIENT_ID` This variable is used to identify the client on keycloak -`CATENAX_PORTAL_DEFAULT_REALM` -This variable is used the set de default realm of the application - -`CATENAX_PORTAL_REALM_LOGO` -This variable is used to replace the logo on the application - `CATENAX_PORTAL_API_URL` This variable points to the desired api @@ -110,7 +102,7 @@ When running the build docker image you are able to pass through multiple enviro ### Example command: ```shell -$ docker run -d -p 4200:8080 -e CATENAX_PORTAL_DEFAULT_REALM=TEST ${dockerImage} +$ docker run -d -p 4200:8080 -e ENV_VAR=VAR_VALUE ${dockerImage} ``` #### `Docker run` @@ -125,7 +117,7 @@ To start a container in detached mode, you use `-d=true` or just `-d` option. By To expose a container’s internal port, an operator can start the container with the `-P` or `-p` flag. The exposed port is accessible on the host and the ports are available to any client that can reach the host. -#### `-e CATENAX_PORTAL_DEFAULT_REALM=TEST` +#### `-e ENV_VAR=VAR_VALUE` The operator can set any environment variable in the container by using one or more `-e` flags, even overriding already defined flags by the developer with a Dockerfile `ENV`. diff --git a/charts/traceability-foss-frontend/templates/deployment.yaml b/charts/traceability-foss-frontend/templates/deployment.yaml index 6cc71b7e7f..b5c511a2d0 100644 --- a/charts/traceability-foss-frontend/templates/deployment.yaml +++ b/charts/traceability-foss-frontend/templates/deployment.yaml @@ -49,8 +49,6 @@ spec: value: "{{ .Values.image.CATENAX_PORTAL_KEYCLOAK_URL }}" - name: CATENAX_PORTAL_CLIENT_ID value: "{{ .Values.image.CATENAX_PORTAL_CLIENT_ID }}" - - name: CATENAX_PORTAL_DEFAULT_REALM - value: "{{ .Values.image.CATENAX_PORTAL_DEFAULT_REALM }}" ports: - name: http containerPort: {{ .Values.service.port }} diff --git a/charts/traceability-foss-frontend/values-dev-test.yaml b/charts/traceability-foss-frontend/values-dev-test.yaml index bcfc4840c2..63969291c1 100644 --- a/charts/traceability-foss-frontend/values-dev-test.yaml +++ b/charts/traceability-foss-frontend/values-dev-test.yaml @@ -3,8 +3,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability-test.dev.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.dev.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' nameOverride: "traceability-foss-test-frontend" fullnameOverride: "traceability-foss-test-frontend" diff --git a/charts/traceability-foss-frontend/values-dev.yaml b/charts/traceability-foss-frontend/values-dev.yaml index eb71d17364..dfe01d1217 100644 --- a/charts/traceability-foss-frontend/values-dev.yaml +++ b/charts/traceability-foss-frontend/values-dev.yaml @@ -2,8 +2,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability.dev.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.dev.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' ingress: enabled: true diff --git a/charts/traceability-foss-frontend/values-int-test.yaml b/charts/traceability-foss-frontend/values-int-test.yaml index 4486b6c6dc..6b5ced412b 100644 --- a/charts/traceability-foss-frontend/values-int-test.yaml +++ b/charts/traceability-foss-frontend/values-int-test.yaml @@ -2,8 +2,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability-test.int.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.int.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' nameOverride: "traceability-foss-test-frontend" fullnameOverride: "traceability-foss-test-frontend" diff --git a/charts/traceability-foss-frontend/values-int.yaml b/charts/traceability-foss-frontend/values-int.yaml index 4fc5052682..437220b0a6 100644 --- a/charts/traceability-foss-frontend/values-int.yaml +++ b/charts/traceability-foss-frontend/values-int.yaml @@ -2,8 +2,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability.int.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.int.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' ingress: enabled: true diff --git a/charts/traceability-foss-frontend/values-pen.yaml b/charts/traceability-foss-frontend/values-pen.yaml index ef141e14f2..3bc8c5cfd8 100644 --- a/charts/traceability-foss-frontend/values-pen.yaml +++ b/charts/traceability-foss-frontend/values-pen.yaml @@ -2,8 +2,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability-pen.dev.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp-pen.dev.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' # important to not conflict with dev env (both use same ArgoCD instance) namespace: product-traceability-foss-pen diff --git a/charts/traceability-foss-frontend/values-pre-prod.yaml b/charts/traceability-foss-frontend/values-pre-prod.yaml index 87e950b674..76b3ada664 100644 --- a/charts/traceability-foss-frontend/values-pre-prod.yaml +++ b/charts/traceability-foss-frontend/values-pre-prod.yaml @@ -2,8 +2,6 @@ image: tag: $ARGOCD_APP_REVISION CATENAX_PORTAL_API_URL: 'https://traceability.pre-prod.demo.catena-x.net/api' CATENAX_PORTAL_KEYCLOAK_URL: 'https://centralidp.pre-prod.demo.catena-x.net/auth' - CATENAX_PORTAL_CLIENT_ID: 'Cl17-CX-Part' - CATENAX_PORTAL_DEFAULT_REALM: 'CX-Central' ingress: enabled: true diff --git a/docs/authentication.md b/docs/authentication.md index dd03de8876..478e6a8dc5 100644 --- a/docs/authentication.md +++ b/docs/authentication.md @@ -1,15 +1,17 @@ ## Authentication -The user authentication is managed by keycloak and each organization has its own realm. +The user authentication is managed by the central keycloak instance managed by catena. +You can configure your IDP there. -The app supports multi tenancy-authentication, so a realm must be specified on the URL. +[Here is a link on how to do that.](https://github.com/catenax-ng/tx-portal-assets/blob/main/docs/02.%20Technical%20Integration/02.%20Identity%20Provider%20Management/02.%20Configure%20Company%20IdP.md) ```bash -http://localhost:4200/${REALM} +http://localhost:4200/ ``` In the app module, there is a function which is executed during the app bootstrap. -That function retrieves the realm provided on the URL, which is used to set up the Keycloak configurations. +That function retrieves the realm provided in the environment variables, +which is used to set up the Keycloak configurations. ### App module provider @@ -28,8 +30,8 @@ That function retrieves the realm provided on the URL, which is used to set up t keycloak.init({ config: { url: environment.keycloakUrl, - realm, - clientId: 'ui', + realm: environment.defaultRealm, + clientId: environment.clientId, }, initOptions: { onLoad: 'login-required', @@ -37,27 +39,3 @@ keycloak.init({ }, }); ``` - -If multi-tenancy is disabled, the default realm is considered. -Those configurations are retrieved from the environment variables. - -```typescript -export const environment = { - defaultRealm: '${REALM}', - ... -}; -``` - -> **Note:** For a deployed app those realms are already configured in the platform chart configurations: - -```yaml -ui: - fullnameOverride: ui - image: ${IMAGE} - hosts: - ${REALM}: ui.${COMPANY-X}.test.catenax.partchain.dev - nodeSelector: - agentpool: application -``` - -When a user navigates to that URL, the realm is mapped with the URL's company name. diff --git a/docs/configuration.md b/docs/configuration.md index 57fc58b381..c89dfa998f 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -154,7 +154,6 @@ export const environment = { defaultRealm: 'mock', realmLogo: '/assets/images/logo.png', apiUrl: '/api', // specify where is placed backend API - realmRegExp: '^https?://[^/]+/([-a-z-A-Z-0-9]+)', baseUrl: '/', mapStyles: 'mapbox://styles/mapbox/light-v10', }; @@ -288,8 +287,6 @@ Support environment variables are: const ENV_VARS_MAPPING = { CATENAX_PORTAL_KEYCLOAK_URL: 'keycloakUrl', CATENAX_PORTAL_CLIENT_ID: 'clientId', - CATENAX_PORTAL_DEFAULT_REALM: 'defaultRealm', - CATENAX_PORTAL_REALM_LOGO: 'realmLogo', CATENAX_PORTAL_API_URL: 'apiUrl', CATENAX_PORTAL_BASE_URL: 'baseUrl', }; @@ -301,12 +298,6 @@ This variable is used to set up and use keycloak `CATENAX_PORTAL_CLIENT_ID` This variable is used to identify the client on keycloak -`CATENAX_PORTAL_DEFAULT_REALM` -This variable is used the set de default realm of the application - -`CATENAX_PORTAL_REALM_LOGO` -This variable is used to replace the logo on the application - `CATENAX_PORTAL_API_URL` This variable points to the desired api diff --git a/scripts/inject-dynamic-env.js b/scripts/inject-dynamic-env.js index b5fcb2a2c2..505357d475 100755 --- a/scripts/inject-dynamic-env.js +++ b/scripts/inject-dynamic-env.js @@ -22,8 +22,6 @@ const fs = require('fs'); const ENV_VARS_MAPPING = { CATENAX_PORTAL_KEYCLOAK_URL: 'keycloakUrl', CATENAX_PORTAL_CLIENT_ID: 'clientId', - CATENAX_PORTAL_DEFAULT_REALM: 'defaultRealm', - CATENAX_PORTAL_REALM_LOGO: 'realmLogo', CATENAX_PORTAL_API_URL: 'apiUrl', CATENAX_PORTAL_BASE_URL: 'baseUrl', }; diff --git a/src/app/modules/core/api/api.service.properties.ts b/src/app/modules/core/api/api.service.properties.ts deleted file mode 100644 index 505abbce50..0000000000 --- a/src/app/modules/core/api/api.service.properties.ts +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2022, 2023 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - * Copyright (c) 2022, 2023 ZF Friedrichshafen AG - * Copyright (c) 2022, 2023 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License, Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0. - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT - * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the - * License for the specific language governing permissions and limitations - * under the License. - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -import { environment } from '@env'; - -export const realmLogo = environment.realmLogo; -export const defaultRealm = environment.defaultRealm; - -export /** @type {*} */ -const realm: string = new RegExp(environment.realmRegExp).exec(window.location.href)?.[1] || defaultRealm; diff --git a/src/app/modules/core/core.routing.ts b/src/app/modules/core/core.routing.ts index e6ecb9f683..e89ac2c14c 100644 --- a/src/app/modules/core/core.routing.ts +++ b/src/app/modules/core/core.routing.ts @@ -23,18 +23,12 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import { LayoutComponent } from '@layout/layout/layout.component'; import { PageNotFoundComponent } from '@page/page-not-found/presentation/page-not-found.component'; -import { defaultRealm, realm } from './api/api.service.properties'; import { AuthGuard } from './auth/auth.guard'; export /** @type {*} */ const routes: Routes = [ { path: '', - redirectTo: defaultRealm, - pathMatch: 'full', - }, - { - path: realm || defaultRealm, component: LayoutComponent, canActivate: [AuthGuard], data: { breadcrumb: 'home' }, diff --git a/src/app/modules/core/layout/nav-bar/nav-bar.component.html b/src/app/modules/core/layout/nav-bar/nav-bar.component.html index bd91461b14..d8eab5d8df 100644 --- a/src/app/modules/core/layout/nav-bar/nav-bar.component.html +++ b/src/app/modules/core/layout/nav-bar/nav-bar.component.html @@ -39,7 +39,7 @@
- +

{{ this.userDetails.role }}

diff --git a/src/app/modules/core/layout/nav-bar/nav-bar.component.ts b/src/app/modules/core/layout/nav-bar/nav-bar.component.ts index 0e93c2c01b..c259e9e85a 100644 --- a/src/app/modules/core/layout/nav-bar/nav-bar.component.ts +++ b/src/app/modules/core/layout/nav-bar/nav-bar.component.ts @@ -21,7 +21,6 @@ import { Component, HostListener } from '@angular/core'; import { Router } from '@angular/router'; -import { realm, realmLogo as _realmLogo } from 'src/app/modules/core/api/api.service.properties'; import { LayoutFacade } from 'src/app/modules/shared/abstraction/layout-facade'; @Component({ @@ -30,13 +29,12 @@ import { LayoutFacade } from 'src/app/modules/shared/abstraction/layout-facade'; styleUrls: ['./nav-bar.component.scss'], }) export class NavBarComponent { - public readonly realmLogo = _realmLogo; public isExpanded = false; public userInitials = ''; public userDetails = { name: '', email: '', role: '' }; constructor(private readonly layoutFacade: LayoutFacade, private readonly router: Router) { - this.userInitials = this.layoutFacade.realmName; + this.userInitials = this.layoutFacade.realName; this.userDetails = this.layoutFacade.userInformation; } @@ -52,7 +50,7 @@ export class NavBarComponent { } public navigateToHome(): void { - this.router.navigate([`/${realm}`]).then(); + this.router.navigate(['']).then(); } @HostListener('window:click', []) diff --git a/src/app/modules/core/user/role.guard.ts b/src/app/modules/core/user/role.guard.ts index 3e02048692..2718ee6e4f 100644 --- a/src/app/modules/core/user/role.guard.ts +++ b/src/app/modules/core/user/role.guard.ts @@ -31,7 +31,6 @@ import { UrlTree, } from '@angular/router'; import { Observable } from 'rxjs'; -import { realm } from '../api/api.service.properties'; import { Role } from './role.model'; import { RoleService } from './role.service'; @@ -66,7 +65,7 @@ export class RoleGuard implements CanActivate, CanActivateChild, CanDeactivate ({ - link: `${realm}/${ABOUT_BASE_ROUTE}`, + link: `${ABOUT_BASE_ROUTE}`, }); diff --git a/src/app/modules/page/admin/admin-route.ts b/src/app/modules/page/admin/admin-route.ts index 19a715c0a3..d54fc7a5d4 100644 --- a/src/app/modules/page/admin/admin-route.ts +++ b/src/app/modules/page/admin/admin-route.ts @@ -19,11 +19,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { realm } from '@core/api/api.service.properties'; import { PageRoute } from '@shared/model/page-route.model'; export const ADMIN_BASE_ROUTE = 'admin'; export const getAdminRoute = (): PageRoute => ({ - link: `${realm}/${ADMIN_BASE_ROUTE}`, + link: `${ADMIN_BASE_ROUTE}`, }); diff --git a/src/app/modules/page/dashboard/dashboard-route.ts b/src/app/modules/page/dashboard/dashboard-route.ts index b9c51b9af0..bc12c1ac23 100644 --- a/src/app/modules/page/dashboard/dashboard-route.ts +++ b/src/app/modules/page/dashboard/dashboard-route.ts @@ -19,11 +19,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { realm } from '@core/api/api.service.properties'; import { PageRoute } from '@shared/model/page-route.model'; export const DASHBOARD_BASE_ROUTE = 'dashboard'; export const getDashboardRoute = (): PageRoute => ({ - link: `${realm}/${DASHBOARD_BASE_ROUTE}`, + link: `${DASHBOARD_BASE_ROUTE}`, }); diff --git a/src/app/modules/page/investigations/investigations-external-route.ts b/src/app/modules/page/investigations/investigations-external-route.ts index 9cd5b59920..da75fb11df 100644 --- a/src/app/modules/page/investigations/investigations-external-route.ts +++ b/src/app/modules/page/investigations/investigations-external-route.ts @@ -19,14 +19,13 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { realm } from '@core/api/api.service.properties'; import { NotificationStatusGroup } from '@shared/model/notification.model'; import { PageRoute } from '@shared/model/page-route.model'; export const INVESTIGATION_BASE_ROUTE = 'investigations'; export const getInvestigationInboxRoute = (investigationStatusGroup?: NotificationStatusGroup): PageRoute => ({ - link: `${realm}/${INVESTIGATION_BASE_ROUTE}`, + link: `${INVESTIGATION_BASE_ROUTE}`, queryParams: investigationStatusGroup ? { tabIndex: String(Object.values(NotificationStatusGroup).indexOf(investigationStatusGroup)), diff --git a/src/app/modules/page/investigations/presentation/investigations.component.spec.ts b/src/app/modules/page/investigations/presentation/investigations.component.spec.ts index 1c5555c7f9..5c2381c0a7 100644 --- a/src/app/modules/page/investigations/presentation/investigations.component.spec.ts +++ b/src/app/modules/page/investigations/presentation/investigations.component.spec.ts @@ -48,7 +48,7 @@ describe('InvestigationsComponent', () => { const viewDetailsButton = await waitFor(() => screen.getByTestId('table-menu-button--actions.viewDetails')); viewDetailsButton.click(); - expect(spy).toHaveBeenCalledWith(['/context/investigations/id-1']); + expect(spy).toHaveBeenCalledWith(['/investigations/id-1']); }); it('should call change pagination of received notification', async () => { diff --git a/src/app/modules/page/other-parts/other-parts-route.ts b/src/app/modules/page/other-parts/other-parts-route.ts index e8a9fb9f13..50ed277b0f 100644 --- a/src/app/modules/page/other-parts/other-parts-route.ts +++ b/src/app/modules/page/other-parts/other-parts-route.ts @@ -19,11 +19,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { realm } from '@core/api/api.service.properties'; import { PageRoute } from '@shared/model/page-route.model'; export const OTHER_PARTS_BASE_ROUTE = 'otherParts'; export const getOtherPartsRoute = (): PageRoute => ({ - link: `${realm}/${OTHER_PARTS_BASE_ROUTE}`, + link: `${OTHER_PARTS_BASE_ROUTE}`, }); diff --git a/src/app/modules/page/parts/parts-route.ts b/src/app/modules/page/parts/parts-route.ts index 86fbbd51e8..587618c268 100644 --- a/src/app/modules/page/parts/parts-route.ts +++ b/src/app/modules/page/parts/parts-route.ts @@ -19,11 +19,10 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -import { realm } from '@core/api/api.service.properties'; import { PageRoute } from '@shared/model/page-route.model'; export const PARTS_BASE_ROUTE = 'parts'; export const getPartsRoute = (): PageRoute => ({ - link: `${realm}/${PARTS_BASE_ROUTE}`, + link: `${PARTS_BASE_ROUTE}`, }); diff --git a/src/app/modules/shared/abstraction/layout-facade.ts b/src/app/modules/shared/abstraction/layout-facade.ts index 0035d10ad6..08aef47468 100644 --- a/src/app/modules/shared/abstraction/layout-facade.ts +++ b/src/app/modules/shared/abstraction/layout-facade.ts @@ -42,7 +42,7 @@ export class LayoutFacade { }; } - public get realmName(): string { + public get realName(): string { return this.userService.firstname; } diff --git a/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts b/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts index c1695ec3e9..312d9dee51 100644 --- a/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts +++ b/src/app/modules/shared/modules/part-details/presentation/part-detail.component.ts @@ -21,7 +21,6 @@ import { AfterViewInit, Component, Input, OnDestroy } from '@angular/core'; import { Router } from '@angular/router'; -import { realm } from '@core/api/api.service.properties'; import { Part, QualityType } from '@page/parts/model/parts.model'; import { PartsAssembler } from '@shared/assembler/parts.assembler'; import { SelectOption } from '@shared/components/select/select.component'; @@ -88,7 +87,7 @@ export class PartDetailComponent implements AfterViewInit, OnDestroy { public openRelationPage(part: Part): void { this.partDetailsFacade.selectedPart = null; - this.router.navigate([`${realm}/parts/relations/${part.id}`]).then(_ => window.location.reload()); + this.router.navigate([`parts/relations/${part.id}`]).then(_ => window.location.reload()); } public updateQualityType(newQualityType: string): void { diff --git a/src/environments/_environment.base.ts b/src/environments/_environment.base.ts index 59779a7d49..87fdb3a21b 100644 --- a/src/environments/_environment.base.ts +++ b/src/environments/_environment.base.ts @@ -27,11 +27,9 @@ export const _environment = { mockService: true, authDisabled: true, keycloakUrl: 'http://localhost:8080/', - clientId: 'catenax-portal', - defaultRealm: 'mock', - realmLogo: '/assets/images/logo.png', + clientId: 'Cl17-CX-Part', + defaultRealm: 'CX-Central', apiUrl: '/api', - realmRegExp: '^https?://[^/]+/([-a-z-A-Z-0-9]+)', baseUrl: '/', mapStyles: 'mapbox://styles/mapbox/light-v10', customProtocols: { diff --git a/src/environments/environment.auth.ts b/src/environments/environment.auth.ts index 7bc55f39d8..b70e2f5e63 100644 --- a/src/environments/environment.auth.ts +++ b/src/environments/environment.auth.ts @@ -28,6 +28,5 @@ export const environment = { apiUrl: 'https://traceability.dev.demo.catena-x.net/api', keycloakUrl: 'https://centralidp.dev.demo.catena-x.net/auth', clientId: 'Cl17-CX-Part', - defaultRealm: 'CX-Central', api: '', }; diff --git a/src/environments/environment.authLocal.ts b/src/environments/environment.authLocal.ts index a829006453..fb2d27ea33 100644 --- a/src/environments/environment.authLocal.ts +++ b/src/environments/environment.authLocal.ts @@ -25,5 +25,4 @@ export const environment = { ..._environment, authDisabled: false, keycloakUrl: 'http://localhost:8080/', - clientId: 'catenax-portal', }; diff --git a/src/environments/environment.authMock.ts b/src/environments/environment.authMock.ts index a9d79da677..70bc6c0da3 100644 --- a/src/environments/environment.authMock.ts +++ b/src/environments/environment.authMock.ts @@ -25,7 +25,5 @@ export const environment = { ..._environment, authDisabled: false, keycloakUrl: 'https://centralidp.dev.demo.catena-x.net/auth', - clientId: 'Cl17-CX-Part', - defaultRealm: 'CX-Central', apiUrl: 'https://traceability.int.demo.catena-x.net/api', }; diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts index a4bdf06e29..1f015a117e 100644 --- a/src/environments/environment.dev.ts +++ b/src/environments/environment.dev.ts @@ -25,5 +25,4 @@ export const environment = { ..._environment, mockService: true, authDisabled: true, - defaultRealm: 'mock', }; diff --git a/src/environments/environment.localBackend.ts b/src/environments/environment.localBackend.ts index bb4c210e89..f6488eba38 100644 --- a/src/environments/environment.localBackend.ts +++ b/src/environments/environment.localBackend.ts @@ -27,7 +27,5 @@ export const environment = { authDisabled: false, mockService: false, keycloakUrl: 'https://centralidp.dev.demo.catena-x.net/auth', - clientId: 'Cl17-CX-Part', - defaultRealm: 'CX-Central', apiUrl: 'http://localhost:8080/api', }; diff --git a/src/environments/environment.production.ts b/src/environments/environment.production.ts index 189f3f0aba..1f65ae53de 100644 --- a/src/environments/environment.production.ts +++ b/src/environments/environment.production.ts @@ -22,7 +22,7 @@ import { _environment } from './_environment.base'; const SCRIPT_EL_ID = 'envConfig'; -const SUPPORTED_ENV_PARAMS = ['keycloakUrl', 'clientId', 'defaultRealm', 'realmLogo', 'apiUrl', 'baseUrl']; +const SUPPORTED_ENV_PARAMS = ['keycloakUrl', 'clientId', 'apiUrl', 'baseUrl']; export const readDynamicEnv = () => { const scriptEl = document.getElementById(SCRIPT_EL_ID) as HTMLScriptElement; @@ -35,7 +35,7 @@ export const readDynamicEnv = () => { dynamicEnv.hasOwnProperty(curr) ? { ...acc, - [curr]: dynamicEnv[curr], + [curr]: dynamicEnv[curr] || _environment[curr], } : acc, {}, @@ -54,7 +54,5 @@ export const environment = { authDisabled: false, mockService: false, keycloakUrl: 'https://centralidp.dev.demo.catena-x.net/auth', - clientId: 'Cl17-CX-Part', - defaultRealm: 'CX-Central', ...readDynamicEnv(), }; From 5f48342ccb502806c97a174d5e9871554d655be8 Mon Sep 17 00:00:00 2001 From: dblankevia <103043573+dblankevia@users.noreply.github.com> Date: Wed, 15 Feb 2023 14:48:45 +0100 Subject: [PATCH 4/4] chr: fix different env var names for veracode in Eclipse and catena-x (#13) --- .github/workflows/veracode.yaml | 49 ------------------- .../{veracode-upload.yml => veracode.yml} | 4 +- 2 files changed, 2 insertions(+), 51 deletions(-) delete mode 100644 .github/workflows/veracode.yaml rename .github/workflows/{veracode-upload.yml => veracode.yml} (80%) diff --git a/.github/workflows/veracode.yaml b/.github/workflows/veracode.yaml deleted file mode 100644 index a5ba9bbea0..0000000000 --- a/.github/workflows/veracode.yaml +++ /dev/null @@ -1,49 +0,0 @@ -name: Veracode Static Analysis Pipeline Scan - -on: - push: - branches: [ main ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ main ] - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -permissions: - contents: read - -jobs: - # This workflow contains a job to build and submit pipeline scan, you will need to customize the build process accordingly and make sure the artifact you build is used as the file input to the pipeline scan file parameter - build-and-pipeline-scan: - # The type of runner that the job will run on - permissions: - contents: read # for actions/checkout to fetch code - security-events: write # for github/codeql-action/upload-sarif to upload SARIF results - runs-on: ubuntu-latest - steps: - - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it and copies all sources into ZIP file for submitting for analysis. Replace this section with your applications build steps - - uses: actions/checkout@v3 - with: - repository: '' - - - run: zip -r veracode-scan-target.zip ./ - - # download the Veracode Static Analysis Pipeline scan jar - - run: curl --silent --show-error --fail -O https://downloads.veracode.com/securityscan/pipeline-scan-LATEST.zip - - run: unzip -o pipeline-scan-LATEST.zip - - - uses: actions/setup-java@v3 - with: - java-version: 8 - distribution: 'temurin' - - run: java -jar pipeline-scan.jar -p "Traceability-FOSS" --veracode_api_id "${{secrets.ORG_VERACODE_API_ID}}" --veracode_api_key "${{secrets.ORG_VERACODE_API_KEY}}" --fail_on_severity="Very High, High" --file veracode-scan-target.zip - continue-on-error: true - - name: Convert pipeline scan output to SARIF format - id: convert - uses: veracode/veracode-pipeline-scan-results-to-sarif@0129fdced6c68f7cad91b6cd6594cf9e0d5ab386 - with: - pipeline-results-json: results.json - - uses: github/codeql-action/upload-sarif@v2 - with: - # Path to SARIF file relative to the root of the repository - sarif_file: veracode-results.sarif diff --git a/.github/workflows/veracode-upload.yml b/.github/workflows/veracode.yml similarity index 80% rename from .github/workflows/veracode-upload.yml rename to .github/workflows/veracode.yml index 7ce8c26732..c6da3a9e56 100644 --- a/.github/workflows/veracode-upload.yml +++ b/.github/workflows/veracode.yml @@ -29,5 +29,5 @@ jobs: appname: "Traceability-Foss-Frontend" createprofile: false filepath: "./veracode-scan-target.zip" - vid: "${{ secrets.ORG_VERACODE_API_ID }}" - vkey: "${{ secrets.ORG_VERACODE_API_KEY }}" + vid: '${{ secrets.VERACODE_API_ID || secrets.ORG_VERACODE_API_ID }}' + vkey: '${{ secrets.VERACODE_API_KEY || secrets.ORG_VERACODE_API_KEY }}' \ No newline at end of file