From b67504a564ae0ddbdb028dd29e2c770dd5886e24 Mon Sep 17 00:00:00 2001 From: maany Date: Mon, 25 Nov 2024 16:06:46 +0100 Subject: [PATCH] login: make userpass login optional --- .../demos/01_0_Login_MultiVO.stories.ts | 2 + .../demos/01_1_Login.stories.tsx | 1 + .../demos/01_1_Login_OIDC.stories.ts | 1 + .../01_2_Login_multi_account.stories.tsx | 1 + .../pages/legacy/Login/Login.stories.tsx | 1 + .../pages/legacy/Login/Login.tsx | 98 ++++++++++--------- src/lib/core/dto/login-config-dto.ts | 1 + .../env-config-gateway-output-port.ts | 5 + src/lib/core/use-case/login-config-usecase.ts | 4 + .../login-config-usecase-models.ts | 2 + .../gateway/env-config-gateway.ts | 8 ++ .../presenter/login-config-presenter.ts | 4 +- 12 files changed, 79 insertions(+), 49 deletions(-) diff --git a/src/component-library/demos/01_0_Login_MultiVO.stories.ts b/src/component-library/demos/01_0_Login_MultiVO.stories.ts index 7a17b2f6b..afac2ba67 100644 --- a/src/component-library/demos/01_0_Login_MultiVO.stories.ts +++ b/src/component-library/demos/01_0_Login_MultiVO.stories.ts @@ -58,6 +58,7 @@ export const ABasicLogin: Story = { args: { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: false, oidcEnabled: false, oidcProviders: [cernOIDCProvider], @@ -86,6 +87,7 @@ export const ABasicMultiVOLogin: Story = { args: { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: true, oidcEnabled: false, oidcProviders: [cernOIDCProvider], diff --git a/src/component-library/demos/01_1_Login.stories.tsx b/src/component-library/demos/01_1_Login.stories.tsx index 09dab7572..592ea64eb 100644 --- a/src/component-library/demos/01_1_Login.stories.tsx +++ b/src/component-library/demos/01_1_Login.stories.tsx @@ -51,6 +51,7 @@ export const Playbook_InitLogin: Story = { args: { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: true, oidcEnabled: true, oidcProviders: [cernOIDCProvider], diff --git a/src/component-library/demos/01_1_Login_OIDC.stories.ts b/src/component-library/demos/01_1_Login_OIDC.stories.ts index 993332b2d..5eb35f151 100644 --- a/src/component-library/demos/01_1_Login_OIDC.stories.ts +++ b/src/component-library/demos/01_1_Login_OIDC.stories.ts @@ -58,6 +58,7 @@ export const AMultiVOOIDCEnabledLogin: Story = { args: { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: true, oidcEnabled: true, oidcProviders: [cernOIDCProvider], diff --git a/src/component-library/demos/01_2_Login_multi_account.stories.tsx b/src/component-library/demos/01_2_Login_multi_account.stories.tsx index 5924f5a28..54c4bb16e 100644 --- a/src/component-library/demos/01_2_Login_multi_account.stories.tsx +++ b/src/component-library/demos/01_2_Login_multi_account.stories.tsx @@ -52,6 +52,7 @@ export const Playbook_Multi_Account: Story = { args: { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: true, oidcEnabled: true, oidcProviders: [cernOIDCProvider], diff --git a/src/component-library/pages/legacy/Login/Login.stories.tsx b/src/component-library/pages/legacy/Login/Login.stories.tsx index 3846fd03d..4a709ab86 100644 --- a/src/component-library/pages/legacy/Login/Login.stories.tsx +++ b/src/component-library/pages/legacy/Login/Login.stories.tsx @@ -51,6 +51,7 @@ export const LoginPage = Template.bind({}); LoginPage.args = { loginViewModel: { status: 'success', + userpassEnabled: true, x509Enabled: true, oidcEnabled: true, oidcProviders: [cernOIDCProvider], diff --git a/src/component-library/pages/legacy/Login/Login.tsx b/src/component-library/pages/legacy/Login/Login.tsx index e2f4f6be8..d567c88e8 100644 --- a/src/component-library/pages/legacy/Login/Login.tsx +++ b/src/component-library/pages/legacy/Login/Login.tsx @@ -101,7 +101,6 @@ export const Login = ({ oidcSubmitHandler: handleOIDCSubmit, }: LoginPageProps) => { const isLoggedIn = loginViewModel.isLoggedIn && loginViewModel.accountActive !== undefined; - const [showUserPassLoginForm, setShowUserPassLoginForm] = useState(false); const [selectedVOTab, setSelectedVOTab] = useState(1); @@ -226,59 +225,62 @@ export const Login = ({ )}