Add OIDC dashboard auth (#1020)
This commit is contained in:
@@ -14,7 +14,8 @@ const SETTINGS_RESPONSE_HEADERS = {
|
||||
export async function GET() {
|
||||
try {
|
||||
const settings = await getSettings();
|
||||
const { password, ...safeSettings } = settings;
|
||||
const { password, oidcClientSecret, ...safeSettings } = settings;
|
||||
safeSettings.oidcConfigured = !!(safeSettings.oidcIssuerUrl && safeSettings.oidcClientId && oidcClientSecret);
|
||||
|
||||
const enableRequestLogs = process.env.ENABLE_REQUEST_LOGS === "true";
|
||||
const enableTranslator = process.env.ENABLE_TRANSLATOR === "true";
|
||||
@@ -63,6 +64,12 @@ export async function PATCH(request) {
|
||||
delete body.currentPassword;
|
||||
}
|
||||
|
||||
if (Object.prototype.hasOwnProperty.call(body, "oidcClientSecret")) {
|
||||
if (!body.oidcClientSecret || !String(body.oidcClientSecret).trim()) {
|
||||
delete body.oidcClientSecret;
|
||||
}
|
||||
}
|
||||
|
||||
const settings = await updateSettings(body);
|
||||
|
||||
// Apply outbound proxy settings immediately (no restart required)
|
||||
@@ -83,7 +90,8 @@ export async function PATCH(request) {
|
||||
resetComboRotation();
|
||||
}
|
||||
|
||||
const { password, ...safeSettings } = settings;
|
||||
const { password, oidcClientSecret, ...safeSettings } = settings;
|
||||
safeSettings.oidcConfigured = !!(safeSettings.oidcIssuerUrl && safeSettings.oidcClientId && oidcClientSecret);
|
||||
return NextResponse.json(safeSettings, { headers: SETTINGS_RESPONSE_HEADERS });
|
||||
} catch (error) {
|
||||
console.log("Error updating settings:", error);
|
||||
|
||||
Reference in New Issue
Block a user