From 8fd877de9b04c235324be41647fda5065e46cba3 Mon Sep 17 00:00:00 2001 From: catherine meng Date: Wed, 6 Mar 2024 10:25:19 -0800 Subject: [PATCH 1/8] feat(1179): enable business bceid login, refs: #1179 --- frontend/public/env.json | 5 ++++ frontend/src/components/Landing.vue | 3 +- .../src/components/common/ProfileSidebar.vue | 30 ++++++++++++------- frontend/src/services/AuthService.ts | 12 ++++++-- frontend/src/services/EnvironmentSettings.ts | 22 ++++++++------ frontend/src/store/FamLoginUserState.ts | 1 + infrastructure/server/oidc_clients_fam.tf | 22 +++++++------- infrastructure/server/outputs.tf | 5 ++++ infrastructure/server/variables_provided.tf | 5 ++++ .../api/app/jwt_validation.py | 7 ++++- .../app/routers/router_admin_user_accesses.py | 11 +++---- .../api/app/routers/router_guards.py | 23 ++++++++++++++ terraform/dev/terragrunt.hcl | 1 + terraform/prod/terragrunt.hcl | 1 + terraform/test/terragrunt.hcl | 1 + terraform/tools/terragrunt.hcl | 1 + 16 files changed, 109 insertions(+), 41 deletions(-) diff --git a/frontend/public/env.json b/frontend/public/env.json index c6ac2b737..50b43af74 100644 --- a/frontend/public/env.json +++ b/frontend/public/env.json @@ -43,6 +43,11 @@ "type": "string", "value": "DEV-IDIR" }, + "fam_console_idp_name_bceid": { + "sensitive": false, + "type": "string", + "value": "TEST-BCEIDBUSINESS" + }, "target_env": { "sensitive": false, "type": "string", diff --git a/frontend/src/components/Landing.vue b/frontend/src/components/Landing.vue index 8d914a78d..e23f504bc 100644 --- a/frontend/src/components/Landing.vue +++ b/frontend/src/components/Landing.vue @@ -32,8 +32,7 @@ import TreeLogs from '@/assets/images/tree-logs.jpg'; outlined label="Login with BCeID" id="login-bceid-button" - disabled - @click="AuthService.login()" + @click="AuthService.loginBceid()" > diff --git a/frontend/src/components/common/ProfileSidebar.vue b/frontend/src/components/common/ProfileSidebar.vue index 8bfdc1b94..173f16999 100644 --- a/frontend/src/components/common/ProfileSidebar.vue +++ b/frontend/src/components/common/ProfileSidebar.vue @@ -11,6 +11,7 @@ const userName = LoginUserState.state.value.famLoginUser!.username; const initials = userName ? userName.slice(0, 2) : ''; const displayName = LoginUserState.state.value.famLoginUser!.displayName; const email = LoginUserState.state.value.famLoginUser!.email; +const organization = LoginUserState.state.value.famLoginUser!.organization; // use local loading state, can't use LoadingState instance // due to logout() is handled by library. @@ -26,13 +27,15 @@ const buttonLabel = computed(() => { }); const adminRoles = computed(() => { - const userAdminRoles = LoginUserState.getUserAdminRoleGroups() + const userAdminRoles = LoginUserState.getUserAdminRoleGroups(); if (userAdminRoles) { - return userAdminRoles.map((adminRole) => { - return adminRole.replace("_", " ") - }).join(", ") + return userAdminRoles + .map((adminRole) => { + return adminRole.replace('_', ' '); + }) + .join(', '); } -}) +});