feat(auth,admin): add LinuxDO OAuth login and admin settings
Implement LinuxDO OAuth authorization-code login flow with state validation and local account binding, and add admin APIs/UI to manage OAuth runtime settings with URL validation and secret masking. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
680b551efd
commit
ae478755be
6 files changed
+355
-6
No files matched your search
@@ -22,6 +22,15 @@ DEFAULT_SETTINGS: dict[str, Any] = {
|
||||
"app_host": "0.0.0.0",
|
||||
"app_port": 8095,
|
||||
"debug": True,
|
||||
"linuxdo_oauth": {
|
||||
"enabled": False,
|
||||
"client_id": "",
|
||||
"client_secret": "",
|
||||
"authorize_url": "https://connect.linux.do/oauth2/authorize",
|
||||
"token_url": "https://connect.linux.do/oauth2/token",
|
||||
"userinfo_url": "https://connect.linux.do/api/user",
|
||||
"scope": "read",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -49,6 +58,12 @@ def _load_settings() -> dict[str, Any]:
|
||||
|
||||
merged = dict(DEFAULT_SETTINGS)
|
||||
merged.update(payload)
|
||||
linuxdo_defaults = DEFAULT_SETTINGS["linuxdo_oauth"]
|
||||
linuxdo_payload = payload.get("linuxdo_oauth", {})
|
||||
if isinstance(linuxdo_payload, dict):
|
||||
merged["linuxdo_oauth"] = {**linuxdo_defaults, **linuxdo_payload}
|
||||
else:
|
||||
merged["linuxdo_oauth"] = dict(linuxdo_defaults)
|
||||
return merged
|
||||
|
||||
|
||||
@@ -82,6 +97,7 @@ class Config:
|
||||
APP_HOST = str(SETTINGS.get("app_host", DEFAULT_SETTINGS["app_host"]))
|
||||
APP_PORT = int(SETTINGS.get("app_port", DEFAULT_SETTINGS["app_port"]))
|
||||
DEBUG = bool(SETTINGS.get("debug", DEFAULT_SETTINGS["debug"]))
|
||||
LINUXDO_OAUTH = SETTINGS.get("linuxdo_oauth", DEFAULT_SETTINGS["linuxdo_oauth"])
|
||||
|
||||
|
||||
class TestConfig(Config):
|
||||
|
||||
Reference in new issue
Block a user