From 969d16b3baeba5acafcbdf0ba16f82c2383d3c98 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Wed, 1 Jan 2025 13:35:08 -0500 Subject: [PATCH 01/32] Add new env to config --- backend/config/__init__.py | 1 + env.template | 11 ++++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/backend/config/__init__.py b/backend/config/__init__.py index 7a5860b2d..a5230e54a 100644 --- a/backend/config/__init__.py +++ b/backend/config/__init__.py @@ -73,6 +73,7 @@ def str_to_bool(value: str) -> bool: DISABLE_DOWNLOAD_ENDPOINT_AUTH = str_to_bool( os.environ.get("DISABLE_DOWNLOAD_ENDPOINT_AUTH", "false") ) +DISABLE_USERPASS_LOGIN = str_to_bool(os.environ.get("DISABLE_USERPASS_LOGIN", "false")) # OIDC OIDC_ENABLED: Final = str_to_bool(os.environ.get("OIDC_ENABLED", "false")) diff --git a/env.template b/env.template index ad2075084..31fe2683d 100644 --- a/env.template +++ b/env.template @@ -35,6 +35,14 @@ AUTHENTIK_BOOTSTRAP_PASSWORD= # Authentication ROMM_AUTH_SECRET_KEY= +# Disable auth on download endpoint for 3rd party support +DISABLE_DOWNLOAD_ENDPOINT_AUTH= +# Disable CSRF protection for development and testing purposes +DISABLE_CSRF_PROTECTION= +# Disable username + passsword login when using OIDC login +DISABLE_USERPASS_LOGIN= + +# OpenID Connect (Authentik, Authelia, etc.) OIDC_ENABLED= OIDC_PROVIDER= OIDC_CLIENT_ID= @@ -56,8 +64,5 @@ SCHEDULED_UPDATE_SWITCH_TITLEDB_CRON=0 4 * * * DISABLE_EMULATOR_JS=false DISABLE_RUFFLE_RS=false -# Disable CSRF protection for development and testing purposes -DISABLE_CSRF_PROTECTION=true - # Logging LOGLEVEL=DEBUG From 3397eaccd538a85c5650c18df8678c1f2ed626c9 Mon Sep 17 00:00:00 2001 From: Georges-Antoine Assi Date: Tue, 7 Jan 2025 16:47:54 -0500 Subject: [PATCH 02/32] hide login button --- backend/endpoints/heartbeat.py | 6 +++++- backend/endpoints/responses/heartbeat.py | 1 + frontend/src/__generated__/models/FrontendDict.ts | 1 + frontend/src/views/Auth/Login.vue | 9 ++++++--- 4 files changed, 13 insertions(+), 4 deletions(-) diff --git a/backend/endpoints/heartbeat.py b/backend/endpoints/heartbeat.py index 845ec11df..e4d448035 100644 --- a/backend/endpoints/heartbeat.py +++ b/backend/endpoints/heartbeat.py @@ -1,6 +1,7 @@ from config import ( DISABLE_EMULATOR_JS, DISABLE_RUFFLE_RS, + DISABLE_USERPASS_LOGIN, ENABLE_RESCAN_ON_FILESYSTEM_CHANGE, ENABLE_SCHEDULED_RESCAN, ENABLE_SCHEDULED_UPDATE_SWITCH_TITLEDB, @@ -64,7 +65,10 @@ def heartbeat() -> HeartbeatResponse: "DISABLE_EMULATOR_JS": DISABLE_EMULATOR_JS, "DISABLE_RUFFLE_RS": DISABLE_RUFFLE_RS, }, - "FRONTEND": {"UPLOAD_TIMEOUT": UPLOAD_TIMEOUT}, + "FRONTEND": { + "UPLOAD_TIMEOUT": UPLOAD_TIMEOUT, + "DISABLE_USERPASS_LOGIN": DISABLE_USERPASS_LOGIN, + }, "OIDC": { "ENABLED": OIDC_ENABLED, "PROVIDER": OIDC_PROVIDER, diff --git a/backend/endpoints/responses/heartbeat.py b/backend/endpoints/responses/heartbeat.py index 7f7d83946..0013337e4 100644 --- a/backend/endpoints/responses/heartbeat.py +++ b/backend/endpoints/responses/heartbeat.py @@ -29,6 +29,7 @@ class EmulationDict(TypedDict): class FrontendDict(TypedDict): UPLOAD_TIMEOUT: int + DISABLE_USERPASS_LOGIN: bool class OIDCDict(TypedDict): diff --git a/frontend/src/__generated__/models/FrontendDict.ts b/frontend/src/__generated__/models/FrontendDict.ts index 9df49ca3c..3f0fbd75d 100644 --- a/frontend/src/__generated__/models/FrontendDict.ts +++ b/frontend/src/__generated__/models/FrontendDict.ts @@ -5,5 +5,6 @@ export type FrontendDict = { UPLOAD_TIMEOUT: number; + DISABLE_USERPASS_LOGIN: boolean; }; diff --git a/frontend/src/views/Auth/Login.vue b/frontend/src/views/Auth/Login.vue index b01a26943..f8db4f65b 100644 --- a/frontend/src/views/Auth/Login.vue +++ b/frontend/src/views/Auth/Login.vue @@ -24,8 +24,10 @@ const visiblePassword = ref(false); const loggingIn = ref(false); const loggingInOIDC = ref(false); -const { ENABLED: oidcEnabled, PROVIDER: oidcProvider } = - heartbeatStore.value.OIDC; +const { + OIDC: { ENABLED: oidcEnabled, PROVIDER: oidcProvider }, + FRONTEND: { DISABLE_USERPASS_LOGIN: loginDisabled }, +} = heartbeatStore.value; // Functions async function login() { @@ -97,6 +99,7 @@ async function loginOIDC() { variant="underlined" /> -