From db3bf4c12c1b011963f0cebf35afc61575332904 Mon Sep 17 00:00:00 2001 From: Jin <22962980+JYC333@users.noreply.github.com> Date: Fri, 6 Jun 2025 17:16:11 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20set=20SSO=20login=20logi?= =?UTF-8?q?c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/server/src/routes/login.ts | 2 ++ apps/server/src/services/open_id.ts | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/apps/server/src/routes/login.ts b/apps/server/src/routes/login.ts index d428f21bf..10bfa5b94 100644 --- a/apps/server/src/routes/login.ts +++ b/apps/server/src/routes/login.ts @@ -19,6 +19,8 @@ function loginPage(req: Request, res: Response) { wrongTotp: false, totpEnabled: totp.isTotpEnabled(), ssoEnabled: openID.isOpenIDEnabled(), + ssoIssuerName: openID.getSSOIssuerName(), + ssoIssuerIcon: openID.getSSOIssuerIcon(), assetPath: assetPath, assetPathFragment: assetUrlFragment, appPath: appPath, diff --git a/apps/server/src/services/open_id.ts b/apps/server/src/services/open_id.ts index e45ed6599..2ae3bbe1e 100644 --- a/apps/server/src/services/open_id.ts +++ b/apps/server/src/services/open_id.ts @@ -8,7 +8,7 @@ import config from "./config.js"; function checkOpenIDConfig() { - let missingVars: string[] = [] + const missingVars: string[] = [] if (config.MultiFactorAuthentication.oauthBaseUrl === "") { missingVars.push("oauthBaseUrl"); } @@ -89,6 +89,14 @@ function isTokenValid(req: Request, res: Response, next: NextFunction) { } } +function getSSOIssuerName() { + return config.MultiFactorAuthentication.oauthIssuerName; +} + +function getSSOIssuerIcon() { + return config.MultiFactorAuthentication.oauthIssuerIcon; +} + function generateOAuthConfig() { const authRoutes = { callback: "/callback", @@ -105,7 +113,7 @@ function generateOAuthConfig() { auth0Logout: false, baseURL: config.MultiFactorAuthentication.oauthBaseUrl, clientID: config.MultiFactorAuthentication.oauthClientId, - issuerBaseURL: "https://accounts.google.com", + issuerBaseURL: config.MultiFactorAuthentication.oauthIssuerBaseUrl, secret: config.MultiFactorAuthentication.oauthClientSecret, clientSecret: config.MultiFactorAuthentication.oauthClientSecret, authorizationParams: { @@ -147,6 +155,8 @@ function generateOAuthConfig() { export default { generateOAuthConfig, getOAuthStatus, + getSSOIssuerName, + getSSOIssuerIcon, isOpenIDEnabled, clearSavedUser, isTokenValid,