mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
Remove setting and pickle
This commit is contained in:
parent
f9294f2634
commit
0d779c3465
4 changed files with 4 additions and 15 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue