From 0d779c34658a620c5c5b341251c43e901b16f7b4 Mon Sep 17 00:00:00 2001
From: Hristo Kapanakov
Date: Sat, 19 Jul 2025 13:47:47 +0300
Subject: [PATCH] Remove setting and pickle
---
.../getting-started/installation/backend-config.md | 1 -
mealie/core/settings/settings.py | 1 -
mealie/routes/auth/auth.py | 5 +----
mealie/routes/auth/auth_cache.py | 12 +++---------
4 files changed, 4 insertions(+), 15 deletions(-)
diff --git a/docs/docs/documentation/getting-started/installation/backend-config.md b/docs/docs/documentation/getting-started/installation/backend-config.md
index 638be4cd4..2fd34f973 100644
--- a/docs/docs/documentation/getting-started/installation/backend-config.md
+++ b/docs/docs/documentation/getting-started/installation/backend-config.md
@@ -113,7 +113,6 @@ For usage, see [Usage - OpenID Connect](../authentication/oidc-v2.md)
| OIDC_GROUPS_CLAIM | groups | Optional if not using `OIDC_USER_GROUP` or `OIDC_ADMIN_GROUP`. This is the claim Mealie will request from your IdP and will use to compare to `OIDC_USER_GROUP` or `OIDC_ADMIN_GROUP` to allow the user to log in to Mealie or is set as an admin. **Your IdP must be configured to grant this claim** |
| OIDC_SCOPES_OVERRIDE | None | Advanced configuration used to override the scopes requested from the IdP. **Most users won't need to change this**. At a minimum, 'openid profile email' are required. |
| OIDC_TLS_CACERTFILE | None | File path to Certificate Authority used to verify server certificate (e.g. `/path/to/ca.crt`) |
-| OIDC_USE_AUTH_CACHE | False | If `True`, OIDC authentication will use server cache instead of session to store its temporary data. |
### OpenAI
diff --git a/mealie/core/settings/settings.py b/mealie/core/settings/settings.py
index 05822c7b6..7af9d481a 100644
--- a/mealie/core/settings/settings.py
+++ b/mealie/core/settings/settings.py
@@ -338,7 +338,6 @@ class AppSettings(AppLoggingSettings):
OIDC_GROUPS_CLAIM: str | None = "groups"
OIDC_SCOPES_OVERRIDE: str | None = None
OIDC_TLS_CACERTFILE: str | None = None
- OIDC_USE_AUTH_CACHE: bool = False
@property
def OIDC_REQUIRES_GROUP_CLAIM(self) -> bool:
diff --git a/mealie/routes/auth/auth.py b/mealie/routes/auth/auth.py
index 6e523c4a0..593ebda89 100644
--- a/mealie/routes/auth/auth.py
+++ b/mealie/routes/auth/auth.py
@@ -29,10 +29,7 @@ remember_me_duration = timedelta(days=14)
settings = get_app_settings()
if settings.OIDC_READY:
- cache = None
- if settings.OIDC_USE_AUTH_CACHE:
- cache = AuthCache()
- oauth = OAuth(cache=cache)
+ oauth = OAuth(cache=AuthCache())
scope = None
if settings.OIDC_SCOPES_OVERRIDE:
scope = settings.OIDC_SCOPES_OVERRIDE
diff --git a/mealie/routes/auth/auth_cache.py b/mealie/routes/auth/auth_cache.py
index dc4040dcf..1cce78feb 100644
--- a/mealie/routes/auth/auth_cache.py
+++ b/mealie/routes/auth/auth_cache.py
@@ -1,11 +1,5 @@
import time
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
-
-
class AuthCache:
def __init__(self, threshold=500, default_timeout=300):
self.default_timeout = default_timeout
@@ -34,14 +28,14 @@ class AuthCache:
try:
expires, value = self._cache[key]
if expires == 0 or expires > time.time():
- return pickle.loads(value)
- except (KeyError, pickle.PickleError):
+ return value
+ except KeyError:
return None
async def set(self, key, value, timeout=None):
expires = self._normalize_timeout(timeout)
self._prune()
- self._cache[key] = (expires, pickle.dumps(value, pickle.HIGHEST_PROTOCOL))
+ self._cache[key] = (expires, value)
return True
async def delete(self, key):