mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-09-12 19:51:00 +05:00
fix(auth): enforce SSO on server-side sign-in endpoints
Resolves #5288. - In better-auth hooks.before, reject /sign-in/email and /sign-in/social with FORBIDDEN when webServerSettings.enforceSSO is enabled - Prevents direct API password authentication when SSO enforcement is enabled
This commit is contained in:
parent
03cdd00fa8
commit
b839e6d6be
@ -125,6 +125,19 @@ const createBetterAuth = () =>
|
||||
...(ctx.context.baseURL ? [new URL(ctx.context.baseURL).origin] : []),
|
||||
...(await resolveTrustedOrigins()),
|
||||
].filter(Boolean);
|
||||
|
||||
if (
|
||||
!IS_CLOUD &&
|
||||
(ctx.path.startsWith("/sign-in/email") ||
|
||||
ctx.path.startsWith("/sign-in/social"))
|
||||
) {
|
||||
const settings = await getWebServerSettings();
|
||||
if (settings?.enforceSSO) {
|
||||
throw new APIError("FORBIDDEN", {
|
||||
message: "SSO is enforced. Direct password and social sign-in are disabled.",
|
||||
});
|
||||
}
|
||||
}
|
||||
}),
|
||||
},
|
||||
emailVerification: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user